note 39561 added to function.method-exists
| From: | chilla at fx3-clan dot de | Date: | Mon, 02 Feb 2004 14:02:29 +0000 |
| Subject: | note 39561 added to function.method-exists | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-64550@lists.php.net to get a copy of this message | ||
I wondered about how to check, if a method exists, without instanzing the class.
In case i want to check the existance of a class-method without instanzing an object from it, u can
use function_exists(CLASSNAME::FUNCTION)
<?php
class bla
{
var $blubb;
function bla()
{
....
}
function test()
{
....
}
}
if(function_exists('bla::test')) {
echo "Whithout instanzing the class, i can tell u, that the method \"test\" in
the class "bla" exists";
}
$bla = new $bla;
if(method_exists($bla,'test')) {
echo "Now, an object is instanzed from the class, and i can tell u by using method_exists()
and my object, that the method \"test\" exists";
}
greets
----
Manual Page -- http://www.php.net/manual/en/function.method-exists.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+39561
Delete -- http://master.php.net/manage/user-notes.php?action=delete+39561&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+39561&report=yes
Search -- http://master.php.net/manage/user-notes.php