Calling a function within a Class method?

前端 未结 10 1082
庸人自扰
庸人自扰 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 06:00

    Try this one:

    class test {
         public function newTest(){
              $this->bigTest();
              $this->smallTest();
         }
    
         private function bigTest(){
              //Big Test Here
         }
    
         private function smallTest(){
              //Small Test Here
         }
    
         public function scoreTest(){
              //Scoring code here;
         }
    }
    
    $testObject = new test();
    
    $testObject->newTest();
    
    $testObject->scoreTest();
    

提交回复
热议问题