PHP list,

I suspect this is a rather basic concept, but I could not find the specifics in the online manual.

I have a set of classes, and the name of each class is stored in a column in a table in my MySQL database. When I want to create an object from one of my classes, I also query the database to get a bunch of data the object needs, along with its name.

So what I end up with is a variable with the name of the class that I want to use stored as a string.

This means that I want to create an object by naming which class with the contents of a variable:

$className = "nameFromDatabase";

$object = new $className();

Is this possible?

I hope I've asked my question clearly. Thank you for any advice.

--
Dave M G

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to