Re: [phplib] Object instance From: Maxim Derkachev (kot <email protected>)
Date: 03/27/01

Hello Bogdan,

Tuesday, March 27, 2001, 10:49:04 AM, you wrote:

BM> In my file I can have:

BM> $objXYZ = new XYZ;

BM> but my question is about creation like this:

BM> $tmp = "XYZ";
BM> $objXYZ = new $tmp;

Right, that will work.

BM> Are some method to build an object starting with the class name?
BM> (like $objXYZ = new Class($tmp); ???? )

class Foo {
 function Foo($tmp) {
    $this = new $tmp;
 }
}

$objXYZ = new Foo($tmp);

That will give you an instance of the class with name stored in the
$tmp variable.

-- 
Best regards,
Maxim Derkachev mailto:kot <email protected>
Symbol-Plus Publishing Ltd.
phone: +7 (812) 324-53-53
http://www.Books.Ru -- All Books of Russia
 

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>