Re: Use of create_function()

From: Date: Sun, 04 Jun 2000 22:12:26 +0000
Subject: Re: Use of create_function()
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-20210@lists.php.net to get a copy of this message
Zeev Suraski wrote: > Per Andrei's request, a simple example: > > <?php > $a = array(3,2,1); > usort($a, create_function('$a,$b', 'return $a-$b;')); > var_dump($a); > ?> > > As you can tell, the first argument denotes the argument list the function > expects to receive, whereas the second argument is the function statement. Am I correct in stating that only one statement can be given as the second argument, ie: <?php $ar = array(3,2,1); usort($a, create_function('$a, $b', '$c = $a + b; return $a - $b;')); var_dump($a); ?> would be invalid. Sterling

« previous php.dev (#20210) next »