Calling a function within a Class method?

前端 未结 10 1054
庸人自扰
庸人自扰 2020-12-02 05:14

I have been trying to figure out how to go about doing this but I am not quite sure how.

Here is an example of what I am trying to do:

class test {
          


        
10条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-02 05:58

      class sampleClass
        { 
            public function f1()
            {
               return "f1 run";
            }
    
            public function f2()
            {
               echo ("f2 run" );
               $result =  $this->f1();
               echo ($result);
            }   
    
        f2();  
    
        }
    

    output :

    f2 run f1 run

提交回复
热议问题