Re: array values format

From: Date: Thu, 20 Feb 2003 05:36:05 +0000
Subject: Re: array values format
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-136314@lists.php.net to get a copy of this message
as per testing it doesnt delete the last comma, i'm doing something like this: for($i=0;$i<sizeof($images);$i++) { $pictures .="\"./archive/bannerimages/".$bid[$i]."/".$images[$i]."\"".","; } preg_replace("/,$/","",$pictures); echo $pictures; is there something wrong with pre_replace? ----- Original Message ----- From: "Chris Cook" <cjc1800@hotmail.com> To: <mikecarel@teamglac.com> Sent: Thursday, February 20, 2003 12:42 PM Subject: Re: [PHP] array values format > Hi Michael, > > Something like this should work: > > for($i=0; $i<sizeof($array); $i++) > { > $data .= $array[$i] . ", "; > } > preg_replace("/, $/", "", $data);//get rid of last comma > echo $data; > > Good luck, > Chris > > > >From: "Michael P. Carel" <mikecarel@teamglac.com> > >To: <php-general@lists.php.net> > >Subject: [PHP] array values format > >Date: Thu, 20 Feb 2003 11:53:18 +0800 > > > >hi to all > > > > > >I have a problem here in array manipulations. I need an output like this > >from the queried data : > > > >"data1","data2","data3" > > > >Any idea how? thanx in advance > > > > > > > >mike > > > > > > > >-- > >PHP General Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php > > > _________________________________________________________________ > STOP MORE SPAM with the new MSN 8 and get 2 months FREE* > http://join.msn.com/?page=features/junkmail

« previous php.general (#136314) next »