note 101181 added to function.is-callable

From: Date: Wed, 01 Dec 2010 11:52:50 +0000
Subject: note 101181 added to function.is-callable
Groups: php.notes 
Request: Send a blank email to php-notes+get-174511@lists.php.net to get a copy of this message
It's worth noting that passing an object and method name will not work for lambdas/closures stored within an object property. Here's a test case in 5.3.3. <?php class TestClass { public $testMethod; public function __construct() { $this->testMethod = function(){}; } } $test = new TestClass(); is_callable(array($test, 'testMethod')); // false is_callable($this->testMethod); // true ---- Server IP: 69.147.83.197 Probable Submitter: 217.155.192.186 ---- Manual Page -- http://www.php.net/manual/en/function.is-callable.php Edit -- https://master.php.net/note/edit/101181 Del: integrated -- https://master.php.net/note/delete/101181/integrated Del: useless -- https://master.php.net/note/delete/101181/useless Del: bad code -- https://master.php.net/note/delete/101181/bad+code Del: spam -- https://master.php.net/note/delete/101181/spam Del: non-english -- https://master.php.net/note/delete/101181/non-english Del: in docs -- https://master.php.net/note/delete/101181/in+docs Del: other reasons-- https://master.php.net/note/delete/101181 Reject -- https://master.php.net/note/reject/101181 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#174511) next »