note 13531 added to function.eval.php
| From: | codeboy at _at_codeboy dot org | Date: | Wed, 20 Jun 2001 18:03:46 +0000 |
| Subject: | note 13531 added to function.eval.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14496@lists.php.net to get a copy of this message | ||
It's possible to do dnyamic class instantiation with eval...for example...
class bar
{
function bob(){ echo "BOB IS COOL"; }
}
$class = 'bar';
eval("\$foo = new {$class}();");
$foo->bob();
will print "BOB IS COOL"
http://www.php.net/manual/en/function.eval.php