note 119899 added to closure.call

From: Date: Fri, 16 Sep 2016 22:12:50 +0000
Subject: note 119899 added to closure.call
Groups: php.notes 
Request: Send a blank email to php-notes+get-206606@lists.php.net to get a copy of this message
Prior PHP 7.0 you can use this code: <?php $cl = function($add) { return $this->a + $add; }; $cl->bindTo($newthis); return call_user_func_array($cl, [10]); ?> But this bind the closure permanently! Also read the article for Closure::bindTo() about binding closures from static context. ---- Server IP: 72.52.91.14 Probable Submitter: 188.169.172.80 ---- Manual Page -- http://php.net/manual/en/closure.call.php Edit -- https://master.php.net/note/edit/119899 Del: integrated -- https://master.php.net/note/delete/119899/integrated Del: useless -- https://master.php.net/note/delete/119899/useless Del: bad code -- https://master.php.net/note/delete/119899/bad+code Del: spam -- https://master.php.net/note/delete/119899/spam Del: non-english -- https://master.php.net/note/delete/119899/non-english Del: in docs -- https://master.php.net/note/delete/119899/in+docs Del: other reasons-- https://master.php.net/note/delete/119899 Reject -- https://master.php.net/note/reject/119899 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#206606) next »