note 108276 added to functions.anonymous

From: Date: Fri, 13 Apr 2012 14:48:15 +0000
Subject: note 108276 added to functions.anonymous
Groups: php.notes 
Request: Send a blank email to php-notes+get-187106@lists.php.net to get a copy of this message
Expanding on earlier posts. You do not need neither __call() nor call_user_func_array() if you fetch the closure into a variable first. <?php class foo { public $test; public function __construct(){ $this->test = function($a) { print $a; }; } } $f = new foo(); $test = $f->test; $test('d'); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 80.252.162.18 ---- Manual Page -- http://www.php.net/manual/en/functions.anonymous.php Edit -- https://master.php.net/note/edit/108276 Del: integrated -- https://master.php.net/note/delete/108276/integrated Del: useless -- https://master.php.net/note/delete/108276/useless Del: bad code -- https://master.php.net/note/delete/108276/bad+code Del: spam -- https://master.php.net/note/delete/108276/spam Del: non-english -- https://master.php.net/note/delete/108276/non-english Del: in docs -- https://master.php.net/note/delete/108276/in+docs Del: other reasons-- https://master.php.net/note/delete/108276 Reject -- https://master.php.net/note/reject/108276 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#187106) next »