note 81922 deleted from function.implode by hholzgra
| From: | hholzgra@php.net | Date: | Thu, 02 Aug 2012 13:19:57 +0000 |
| Subject: | note 81922 deleted from function.implode by hholzgra | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-189750@lists.php.net to get a copy of this message | ||
Note Submitter: ngkongs at gmail dot com
----
implode() can't be used for simplexml's array but foreach() does the thing, make new
implode function with foreach() will resolve this problem. use strval() to reset SimpleXMLElement
object to a simple string variable.
<?php
function implode2($glue="", $var){
if ($var){
foreach ($var as $value){
$array[]=strval($value);
}
return implode($glue, $array);
}
else return false;
}
?>