Setting a function equal a variable?

后端 未结 3 1231
不思量自难忘°
不思量自难忘° 2021-01-29 06:20

I have a PHP function and I want it to equal a variable. Here is the code:

 
3条回答
  •  [愿得一人]
    2021-01-29 06:44

    You can't make a function equal a variable, but how about a variable that equals a function?

    $ItsaFunction = function() {
        //Code goes here
    };
    

    You could also do

    function ItsaFunction() {
        //Code goes here
    }
    
    $ItsaFunction = ItsaFunction(); 
    

提交回复
热议问题