Calling a function within a Class method?

前端 未结 10 1055
庸人自扰
庸人自扰 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:19

    In order to have a "function within a function", if I understand what you're asking, you need PHP 5.3, where you can take advantage of the new Closure feature.

    So you could have:

    public function newTest() {
       $bigTest = function() {
            //Big Test Here
       }
    }
    

提交回复
热议问题