note 27967 added to function.method-exists

From: Date: Fri, 27 Dec 2002 18:49:44 +0000
Subject: note 27967 added to function.method-exists
Groups: php.notes 
Request: Send a blank email to php-notes+get-41353@lists.php.net to get a copy of this message
if you want to check for a method "inside" of a class use: method_exists($this, 'function_name') i was a bit confused 'cause i thought i'm only able to check for a method when i got an object like $object_name = new class_name() with: method_exists($object_name, 'method_name') small example for those who didn't understood what i mean ( maybe caused by bad english :) ): <?php class a { function a() { if(method_exists($this, 'test')) echo 'a::test() exists!'; else echo 'a::test() doesn\'t exists'; } function test() { return true; } } $b = new a(); ?> the output will be: a::test() exists! maybe this will help someone -- http://www.php.net/manual/en/function.method-exists.php http://master.php.net/manage/user-notes.php?action=edit+27967 http://master.php.net/manage/user-notes.php?action=delete+27967 http://master.php.net/manage/user-notes.php?action=reject+27967

« previous php.notes (#41353) next »