Problem with dynamic variable used as classname (static)
Posted: Fri Feb 06, 2009 4:11 am
Hey everyone,
Its been a long time since I posted here!
Anyhow, I'm having a little problem doing this:
the error it thrown is:
Parse error: syntax error, unexpected '{' in /index.php on line 29
I know for a fact that"
works with no problem, why doesnt the same concept work in a static call?
How can I work around that (please dont tell me to use eval!)
Cheers,
Marc
Its been a long time since I posted here!
Anyhow, I'm having a little problem doing this:
Code: Select all
$obj_instance = {$str_class}::getInstance(Request::get('id'));
Parse error: syntax error, unexpected '{' in /index.php on line 29
I know for a fact that"
Code: Select all
$obj_instance = new {$str_class}();
How can I work around that (please dont tell me to use eval!)
Cheers,
Marc