[thelist] PHP conditionally create a class method?

Matt McKeon matt at camadro.com
Wed Aug 27 13:33:55 CDT 2008


Stephen Rider wrote:
> ARGH!
> 
> Sorry -- wrong error message.  The error I'm getting is this:
> 
> [27-Aug-2008 01:33:28] hello
> [27-Aug-2008 01:33:28] method doesn't exist
> [27-Aug-2008 01:33:28] PHP Fatal error:  Cannot redeclare myfunction()  
> (previously declared in /path/to/my/script.php:17) in /path/to/my/ 
> script.php on line 17
> 
> 
> Again... if ( ! method_exists( $this, 'myfunctions' ) ) returns true,  
> which should only happen if the method does _not_ already exist.  But  
> then I'm getting an error that the method already exists.
> 

Stephen,
Maybe the create_function function could help you? 
http://us2.php.net/manual/en/function.create-function.php

HTH
Matt



More information about the thelist mailing list