note 93791 added to function.call-user-func
| From: | ulderico at maber dot com dot br | Date: | Tue, 29 Sep 2009 16:19:40 +0000 |
| Subject: | note 93791 added to function.call-user-func | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-161150@lists.php.net to get a copy of this message | ||
PHP 5.3 is prone to black magic.
Now, you can do this:
$arr = array(1,2);
isset($arr) && is_array($arr) && sizeof($arr) > 0 &&
call_user_func(function() use ($arr) {foreach($arr as $a){print_r($a);}});
It's valid, it'll work.
Should you do it? No.
----
Server IP: 187.16.23.128
Probable Submitter: 187.37.26.30
----
Manual Page -- http://www.php.net/manual/en/function.call-user-func.php
Edit -- https://master.php.net/note/edit/93791
Del: integrated -- https://master.php.net/note/delete/93791/integrated
Del: useless -- https://master.php.net/note/delete/93791/useless
Del: bad code -- https://master.php.net/note/delete/93791/bad+code
Del: spam -- https://master.php.net/note/delete/93791/spam
Del: non-english -- https://master.php.net/note/delete/93791/non-english
Del: in docs -- https://master.php.net/note/delete/93791/in+docs
Del: other reasons-- https://master.php.net/note/delete/93791
Reject -- https://master.php.net/note/reject/93791
Search -- https://master.php.net/manage/user-notes.php