note 98978 added to functions.anonymous

From: Date: Tue, 20 Jul 2010 05:56:51 +0000
Subject: note 98978 added to functions.anonymous
Groups: php.notes 
Request: Send a blank email to php-notes+get-170982@lists.php.net to get a copy of this message
If you want to make a recursive closure, you will need to write this: $some_var1="1"; $some_var2="2"; function($param1, $param2) use ($some_var1, $some_var2) { //some code here call_user_func(__FUNCTION__, $other_param1, $other_param2); //some code here } If you need to pass values by reference you should check out http://www.php.net/manual/en/function.call-user-func.php http://www.php.net/manual/en/function.call-user-func-array.php If you're wondering if $some_var1 and $some_var2 are still visible by using the call_user_func, yes, they are available. ---- Server IP: 69.147.83.197 Probable Submitter: 89.136.123.72 ---- Manual Page -- http://www.php.net/manual/en/functions.anonymous.php Edit -- https://master.php.net/note/edit/98978 Del: integrated -- https://master.php.net/note/delete/98978/integrated Del: useless -- https://master.php.net/note/delete/98978/useless Del: bad code -- https://master.php.net/note/delete/98978/bad+code Del: spam -- https://master.php.net/note/delete/98978/spam Del: non-english -- https://master.php.net/note/delete/98978/non-english Del: in docs -- https://master.php.net/note/delete/98978/in+docs Del: other reasons-- https://master.php.net/note/delete/98978 Reject -- https://master.php.net/note/reject/98978 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170982) next »