note 39561 deleted from function.method-exists by nlopess
| From: | nlopess@php.net | Date: | Fri, 12 Mar 2004 14:48:37 +0000 |
| Subject: | note 39561 deleted from function.method-exists by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66735@lists.php.net to get a copy of this message | ||
Note Submitter: chilla@fx3-clan.de
----
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