Am Sun, 22 May 2005 10:42:56 -0700 schrieb
ni***********@gmail.com:
Hey,
is it possible to define a constant - lets say
define('CLASS_NAME','Shows');
and then initialize the Shows class with
$obj = new CLASS_NAME();
This obviously doesn't work, but how would i have to do it to make it
work?
Best regards,
Nikolai Onken
Try it this way:
define('CLASS_NAME','Shows');
$classname = CLASS_NAME;
$obj = new $classname;
or with eval:
define('CLASS_NAME','Shows');
$obj = eval('new ' . CLASS_NAME . '();');
--
-------------------------------------------------------
Try this: SCA the Smart Class Archive for PHP
http://www.project-sca.org
-------------------------------------------------------