PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
Flamie
Forum Contributor
Posts: 166 Joined: Mon Mar 01, 2004 3:19 pm
Post
by Flamie » Sat Jun 03, 2006 11:26 pm
Say I have like:
What I want to do is something like this:
Code: Select all
$npc = new $npc_name(); //I wnat this to act as $npc = new Mayor();
So is it doable in someway?
bdlang
Forum Contributor
Posts: 395 Joined: Tue May 16, 2006 8:46 pm
Location: Ventura, CA US
Post
by bdlang » Sat Jun 03, 2006 11:41 pm
Flamie
Forum Contributor
Posts: 166 Joined: Mon Mar 01, 2004 3:19 pm
Post
by Flamie » Sat Jun 03, 2006 11:49 pm
thanks a lot.
Christopher
Site Administrator
Posts: 13596 Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US
Post
by Christopher » Sun Jun 04, 2006 12:41 am
Flamie wrote: Code: Select all
$npc_name = "Mayor";
$npc = new $npc_name(); //I wnat this to act as $npc = new Mayor();
So is it doable in someway?
Did you try it before you asked the question?
(#10850)
Oren
DevNet Resident
Posts: 1640 Joined: Fri Apr 07, 2006 5:13 am
Location: Israel
Post
by Oren » Sun Jun 04, 2006 2:44 am
arborint wrote: Did you try it before you asked the question?
I don't get this kind of posts at all... Couldn't you just try it?