note 89873 rejected from functions.anonymous by danbrown

From: Date: Thu, 26 Mar 2009 18:34:38 +0000
Subject: note 89873 rejected from functions.anonymous by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-152486@lists.php.net to get a copy of this message
Note Submitter: sean at middleditch dot us ---- So are these actual closures, or just anonymous functions? That is, can they access/bind to variables in the scope the function is defined in? e.g. $field = 'name'; usort($array, function($a, $b) { return $a->$name > $b->$name; }); or even: $count = 0; array_walk($tree, function($e) { if (check_if_good($e)) ++$count; }); echo $count;

« previous php.notes (#152486) next »