note 92986 deleted from function.implode by danbrown
| From: | danbrown@php.net | Date: | Tue, 18 Aug 2009 17:21:26 +0000 |
| Subject: | note 92986 deleted from function.implode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-159601@lists.php.net to get a copy of this message | ||
Note Submitter: giorgini at interlogica dot net
----
I finally managed to get a one-line invocation of implode to get a string with wrapped elements.
So if
$a = array ( 1 , 2 , 3 , 4 );
then,
implode ( "," , $a ) = "1,2,3,4"
but you want your output to be '1','2','3','4';
this should do the trick:
implode ( "," , array_map ( create_function ( '$str' , 'return "'
. "'" . '" . $str . "' . "'" . '";'
) , $ar ) )