Re: [PHP] changing array to a string
join is also an alias for implode in case you're having trouble remembering the name, so you can go for $ids = join(',', $_POST['subscriptions']); -- itoctopus - http://www.itoctopus.com "Chris" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Richard Kurth wrote: > > When I submit the for below it gives me an array that looks like this > > "array(5) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "5" > > [3]=> string(1) "6" [4]=> string(1) "7" } " > > I would like to convert it to a string like this "3,4,5,6,7" > > $ids = implode(',', $_POST['subscriptions']); > > -- > Postgresql & php tutorials > http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] changing array to a string
Richard Kurth wrote: > When I submit the for below it gives me an array that looks like this > "array(5) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "5" > [3]=> string(1) "6" [4]=> string(1) "7" } " > I would like to convert it to a string like this "3,4,5,6,7" $ids = implode(',', $_POST['subscriptions']); Thanks I keep trying explode and forgot about implode -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] changing array to a string
> -Original Message- > From: Richard Kurth [mailto:[EMAIL PROTECTED] > Sent: Wednesday, March 28, 2007 6:12 AM > To: php-general@lists.php.net > Subject: [PHP] changing array to a string > > When I submit the for below it gives me an array that looks like this > "array(5) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "5" > [3]=> string(1) "6" [4]=> string(1) "7" } " > I would like to convert it to a string like this "3,4,5,6,7" > > > > > type="checkbox">test message > value="4" type="checkbox">test message > value="5" type="checkbox">test message > value="6" type="checkbox">test message > value="7" type="checkbox">test message > > > > > > [Peter Lauri - DWS Asia] Check www.php.net/implode Best regards, Peter Lauri www.dwsasia.com - company web site www.lauri.se - personal web site www.carbonfree.org.uk - become Carbon Free -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] changing array to a string
Richard Kurth wrote: When I submit the for below it gives me an array that looks like this "array(5) { [0]=> string(1) "3" [1]=> string(1) "4" [2]=> string(1) "5" [3]=> string(1) "6" [4]=> string(1) "7" } " I would like to convert it to a string like this "3,4,5,6,7" $ids = implode(',', $_POST['subscriptions']); -- Postgresql & php tutorials http://www.designmagick.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php