Re: [PHP] array values format
In a message dated 2/19/2003 8:44:53 PM Pacific Standard Time, [EMAIL PROTECTED] writes: >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 $string = '"'.implode('","',$testarray).'"'; Janet -- Janet Valade Author, PHP & MySQL for Dummies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array values format
thanks it working now - Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 20, 2003 2:40 PM Subject: Re: [PHP] array values format > On Thursday 20 February 2003 13:36, Michael P. Carel wrote: > > as per testing it doesnt delete the last comma, i'm doing something like > > this: > > > > for($i=0;$i > { > > $pictures .="\"./archive/bannerimages/".$bid[$i]."/".$images[$i]."\"".","; > > } > > preg_replace("/,$/","",$pictures); > > echo $pictures; > > > > is there something wrong with pre_replace? > > Just use: > > $rest = substr("abcdef", 0, -1); // returns "abcde" > > > to chop off the last character (comma). > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > In a medium in which a News Piece takes a minute and an "In-Depth" > Piece takes two minutes, the Simple will drive out the Complex. > -- Frank Mankiewicz > */ > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array values format
On Thursday 20 February 2003 13:36, Michael P. Carel wrote: > as per testing it doesnt delete the last comma, i'm doing something like > this: > > for($i=0;$i { > $pictures .="\"./archive/bannerimages/".$bid[$i]."/".$images[$i]."\"".","; > } > preg_replace("/,$/","",$pictures); > echo $pictures; > > is there something wrong with pre_replace? Just use: $rest = substr("abcdef", 0, -1); // returns "abcde" to chop off the last character (comma). -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In a medium in which a News Piece takes a minute and an "In-Depth" Piece takes two minutes, the Simple will drive out the Complex. -- Frank Mankiewicz */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] array values format
as per testing it doesnt delete the last comma, i'm doing something like this: for($i=0;$i To: <[EMAIL PROTECTED]> 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 { > $data .= $array[$i] . ", "; > } > preg_replace("/, $/", "", $data);//get rid of last comma > echo $data; > > Good luck, > Chris > > > >From: "Michael P. Carel" <[EMAIL PROTECTED]> > >To: <[EMAIL PROTECTED]> > >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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] array values format
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