Dynamic Function Call

From: Date: Mon, 07 Jun 2004 01:47:00 +0000
Subject: Dynamic Function Call
Groups: php.general 
Request: Send a blank email to php-general+get-187767@lists.php.net to get a copy of this message
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.

« previous php.general (#187767) next »