note 87889 modified in function.implode by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Dec 2008 18:59:11 +0000 |
| Subject: | note 87889 modified in function.implode by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-148648@lists.php.net to get a copy of this message | ||
For anyone looking for a good method to wrap each element before imploding it, I use this method:
<?php
function wrap_each(&$item)
{
$item = "'$item'";
}
array_walk($array, 'wrap_each');
$array_csv = implode(",", $array);
?>
--was--
For anyone looking for a good method to wrap each element before imploding it, I use this method:
function wrap_each(&$item)
{
$item = "'$item'";
}
array_walk($array, 'wrap_each');
$array_csv = implode(",", $array);
http://php.net/manual/en/function.implode.php