note 40613 added to function.function-exists
| From: | ckrack at i-z dot de | Date: | Tue, 09 Mar 2004 17:22:27 +0000 |
| Subject: | note 40613 added to function.function-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-66508@lists.php.net to get a copy of this message | ||
i was wondering whether is_callable or function exists is faster when checking class methods.
is_callable(array('foo', 'bar'));
function_exists('foo::bar');
my results when doing each operation 10000 times with a simple test class were the following:
is_callable: 0.28671383857727 seconds
function_exists: 0.14569997787476 seconds
(following tests have proved this to be true).
thus you can see, function_exists is twice as fast as is_callable.
----
Manual Page -- http://www.php.net/manual/en/function.function-exists.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40613
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40613&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40613&report=yes
Search -- http://master.php.net/manage/user-notes.php