Bug #18016 Updated: function_exists, call_user_func_* and methods
| From: | akul at otamedia dot com | Date: | Thu, 27 Jun 2002 13:13:28 +0000 |
| Subject: | Bug #18016 Updated: function_exists, call_user_func_* and methods | ||
| References: | 1 | Groups: | php.bugs php.doc |
| Request: | Send a blank email to php-bugs+get-12242@lists.php.net to get a copy of this message | ||
ID: 18016
Updated by: akul@otamedia.com
Reported By: akul@otamedia.com
Status: Open
Bug Type: Documentation problem
Operating System: all
PHP Version: 4.2.1
New Comment:
Thanks! But how about function_exists()?
function_exists(array("test","staticFunction"))
doesn't work.
Previous Comments:
------------------------------------------------------------------------
[2002-06-27 08:15:38] mfischer@php.net
The syntax for calling static class methods is
array('classname', 'methodname');
Reclassiyfing as documentation problem.
------------------------------------------------------------------------
[2002-06-27 08:08:05] akul@otamedia.com
<?
class test
{
function staticFunction($a)
{
echo "\ntest::staticFunction($a)";
}
}
echo "\nTest page\n";
echo 'function_exists=['.function_exists("test::staticFunction").']';
test::staticFunction(999);
call_user_func_array("test::staticFunction",array(999));
?>
Result:
Test page
function_exists=[]
test::staticFunction(999)
Warning: call_user_func_array() expects first argument,
'test::staticFunction',
to be a valid callback in bug.php on line 17
Must be:
Test page
function_exists=[TRUE]
test::staticFunction(999)
test::staticFunction(999)
(Please, don't write me stupid comments about method_exists()! Just
read one more time function name.)
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18016&edit=1