Re: Designing for PHP4 with PHP5 in mind...

From: Date: Tue, 07 Jan 2003 09:49:58 +0000
Subject: Re: Designing for PHP4 with PHP5 in mind...
References: 1 2 3 4 5  Groups: php.dev 
Request: Send a blank email to php-dev+get-93213@lists.php.net to get a copy of this message
Hi, > [FROM] Leon Atkinson > <? > class a {} > > function c($c) > { > $c->name = 'C'; > } > > $a = new a; > $b = $a; > > $a->name = "A"; > print($a->name); > $b->name = "B"; > print($a->name); > c($a); > print($a->name); > ?> > > In ZE1 you get "AAA". In ZE2 you get "ABC". > Just to prevent any misconception, the code executed through the ZE1 will actually be "AAC" rather than "AAA". If you desired the latter result, change "c($a);" to "c($b);". </pickyCorrection> -- Dan Hardiker [dhardiker@staff.firstcreative.net] ADAM Software & Systems Engineer First Creative

« previous php.dev (#93213) next »