note 53443 deleted from language.oop5 by et

From: Date: Sat, 15 Oct 2005 09:19:04 +0000
Subject: note 53443 deleted from language.oop5 by et
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-97063@lists.php.net to get a copy of this message
Note Submitter: gaehngaehn at hotmail dot com ---- This might be trivial but took me some time to figure out. I needed to create an object of a class, but did not know the name of the class in advance. While vor methods/variables one can use strings (such as in $object->$variable), the following is not allowed: $a = new $class; The only way I could achieve that was to use eval: eval("\$a = new $class;");

« previous php.notes (#97063) next »