note 28705 modified in function.function-exists by tularis

From: Date: Tue, 21 Jan 2003 21:06:42 +0000
Subject: note 28705 modified in function.function-exists by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-42535@lists.php.net to get a copy of this message
[Editor's Note] It is recommended to use PHP's built-in method_exists() function for this. [/Note] To see if there exists a method in the class, use is_callable() instead of function_exists(): $funname = 'foobarfunc'; if(is_callable(Array($this, $funname))) eval('$this->'.$funname.'();'); else print "The sky just fell, ouch\n"; --was-- [Editor's Note] It is recommended to use PHP's built-in method_exists() function for this. [/Note] To see if there exists a method in the class, use is_callable() instead of function_exists(): $funname = 'foobarfunc'; if(is_callable(Array($this, $funname))) eval('$this->'.$funname.'();'); else print "The sky just fell, ouch\n"; http://www.php.net/manual/en/function.function-exists.php

« previous php.notes (#42535) next »