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
Darkzaelus
Forum Commoner
Posts: 94 Joined: Tue Sep 09, 2008 7:02 am
Post
by Darkzaelus » Tue Sep 09, 2008 12:49 pm
How on earth do people do
Is name 2 an object initialised with $name1=new class()?
Cheers, Darkzaelus
dude81
Forum Regular
Posts: 509 Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City
Post
by dude81 » Tue Sep 09, 2008 12:56 pm
name2 could be a property or a method of class "class" i.e
Code: Select all
class myAnotherClass(){
public $name2;
function __construct(){
$this->name2 = 'Darkzaelus';
}
Code: Select all
class myClass{
public $name1;
function __construct(){
$this->name1 = new myAnotherClass();
}
then I can access your name
Code: Select all
$name = new myClass();
echo $name->name1->name2;
Last edited by
dude81 on Tue Sep 09, 2008 12:58 pm, edited 1 time in total.
Darkzaelus
Forum Commoner
Posts: 94 Joined: Tue Sep 09, 2008 7:02 am
Post
by Darkzaelus » Tue Sep 09, 2008 12:57 pm
Fantastic!
Anyone know the limitations dimension wise?
Cheers, Darkzaelus
dude81
Forum Regular
Posts: 509 Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City
Post
by dude81 » Tue Sep 09, 2008 1:01 pm
what do you mean by dimension wise
andyhoneycutt
Forum Contributor
Posts: 468 Joined: Wed Aug 27, 2008 10:02 am
Location: Idaho Falls
Post
by andyhoneycutt » Tue Sep 09, 2008 1:08 pm
i'm pretty sure you can nest them as long as you have resources, if that's what you're asking.
dude81
Forum Regular
Posts: 509 Joined: Mon Aug 29, 2005 6:26 am
Location: Pearls City
Post
by dude81 » Tue Sep 09, 2008 1:11 pm
Darkzaelus
Forum Commoner
Posts: 94 Joined: Tue Sep 09, 2008 7:02 am
Post
by Darkzaelus » Tue Sep 09, 2008 1:13 pm
Thanks a lot!
Cheers, Darkzaelus