Re: arrays as object properties

From: Date: Thu, 26 Oct 2000 08:38:29 +0000
Subject: Re: arrays as object properties
Groups: php.general 
Request: Send a blank email to php-general+get-22087@lists.php.net to get a copy of this message
Hi Rebecca, Just append this code to your exisiting and try it out, it should work if that's what you are trying to do! for ($i = 0; $i < sizeof($car->parts); $i++) { echo $car->parts[$i]; } --- Rebecca <rebecca@digitalpulp.com> wrote: > so if i have: > > class car { > > var $parts; > > function init($new_parts) { > $this->parts = $new_parts; > } > } > > how can i make this work: > > $parts = array("radio","four_w_drive","mats","si"); > $car = new car; > > //the following peice of code is the trouble......i > can't seem to make an > object property an array.... > $car->init($parts); > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: > php-general-unsubscribe@lists.php.net > For additional commands, e-mail: > php-general-help@lists.php.net > To contact the list administrators, e-mail: > php-list-admin@lists.php.net > ===== To Find Out More About Me : http://mukul.tsx.org/ __________________________________________________ Do You Yahoo!? Yahoo! Messenger - Talk while you surf! It's FREE. http://im.yahoo.com/

« previous php.general (#22087) next »