Thx for quick reply,

If I use the following:
        $object = new {classname};

I get this a parse error:
        Parse error: parse error, expecting `T_STRING' or `T_VARIABLE'
or `'$'' in
/home/sites/ on
line 29

>From that I conclude that with this method its not possible to create an
object from a variable class name

Michiel ten Hagen

-----Oorspronkelijk bericht-----
Van: Mathieu Dumoulin [mailto:[EMAIL PROTECTED]] 
Verzonden: Wednesday, July 24, 2002 3:11 PM
Onderwerp: Re: create object from variable class.

Simple, you made an error here
You are telling the new operator to look into a variable to get the
classname, to specify the class name as a string do this:

$object = new {$classname};


Ps: I never tried this, but I think it is actually going to work, you
got nthing to lose anyway I guess, takes two seconds to try.

"Karel De Groot" <[EMAIL PROTECTED]> wrote in message
> Is it possible to create an object from a clas which name is in a
> variable.
> Example: (doesn't work)
> $object = new ${$classname};

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to