Re: array in the class
| From: | Daniel Convissor | Date: | Sat, 02 Dec 2000 16:10:44 +0000 |
| Subject: | Re: array in the class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28370@lists.php.net to get a copy of this message | ||
Hi Arnost:
Things are working just as they should. Let's talk our way through this by
adding comments to the code...
# put one into a
$a= new Sample("One");
# put two into b
$b= new Sample("Two");
# put three into c
$c= new Sample("Three");
# append b (two) onto a (which already has one)
$a->set_parsed(array($b));
# append c (three) onto b (which already has two)
$b->set_parsed(array($c));
# print out what's in a
$a->print_me();
# Name: Two
# Name: One
echo "<hr>";
but when I switch the set_parsed calls:
# put one into a
$a= new Sample("One");
# put two into b
$b= new Sample("Two");
# put three into c
$c= new Sample("Three");
# append c (three) onto b (which already has two)
$b->set_parsed(array($c));
# append b (which now has two and three) onto a (which has one already)
$a->set_parsed(array($b));
# print out what's in a
$a->print_me();
# Name: Three
# Name: Two
# Name: One
Enjoy,
--Dan
--
PHP scripts that make your job easier
http://www.analysisandsolutions.com/code/
SQL Solution | Layout Solution | Form Solution
T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y
4015 7 Ave, Brooklyn NY 11232 v: 718-854-0335 f: 718-854-0409