036-PHP closed field limits the packet function, and how to pass variables to the closure function

<? PHP
 // domain restrictions closure function, and how to pass variables to the closure function 

    # hidden above code, we finally come to try 
    function Demo ( $ ATxt ) 
    { 
        $ FUNC = function () use ( $ ATxt ) {
             echo  $ ATxt ; 
        }; 
        $ FUNC (); 
    } 

# calling a test 
demo ( '~ I love PHP' );

 ?>

 

Guess you like

Origin www.cnblogs.com/tianpan2019/p/10993335.html