Hi,

Monday, June 7, 2004, 11:47:00 AM, you wrote:

> Hello everyone!

> I'm trying to call a class method dynamically, but keep getting a SYNTAX
> ERROR. Can anyone shed some light on this? Is this impossible?

> ==The Code

> function &modCall($_class){
>   $this->LoadClass($_class);   //LoadClass includes the class file, but
>                                //does not initialize it.

>   //if the class has the method, then call it.

>   if(in_array('sayHello',get_class_methods($_class)){

>            $_class::sayHello();

>            // this line reports a syntax error with $_class::sayHello()
>            // but (assuming the value of $_class was 'myClass')
>            // myClass::sayHello() works!

>   }

>     //I've also tried the following:
>     //   ${_class)::sayHello();
>     //   {$_class}::sayHello();
>     //   $_class.'::sayHello()';

> }

> Any suggestions!






> =P e p i e  D e s i g n s
>  www.pepiedesigns.com
>  Providing Solutions That Increase Productivity

>  Web Developement. Database. Hosting. Multimedia.


You could try eval()

-- 
regards,
Tom

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to