converting array into a string

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

converting array into a string

Post by pelegk2 »

i have an array
say : (3,"435",5,886,"sdr");
can i some how convert it to one string with delimiters say like :
"3,435,5,886,sdr"
??
User avatar
emperor
Forum Newbie
Posts: 16
Joined: Tue Mar 02, 2004 11:20 am
Location: UK

Post by emperor »

Try using [php_man]implode[/php_man] - eg...

Code: Select all

<?php
    $array = array (3, '435', 5, 886, 'sdr');
    $string = implode (',', $array);
?>
Last edited by emperor on Mon Nov 08, 2004 5:19 am, edited 2 times in total.
User avatar
pelegk2
Forum Regular
Posts: 633
Joined: Thu Nov 27, 2003 5:02 am
Location: Israel - the best place to live in after heaven
Contact:

Post by pelegk2 »

thansk alot
Post Reply