note 57704 deleted from function.serialize by aharvey
| From: | aharvey@php.net | Date: | Tue, 06 Nov 2012 02:08:40 +0000 |
| Subject: | note 57704 deleted from function.serialize by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-191762@lists.php.net to get a copy of this message | ||
Note Submitter: Sean at http://seanj dot jcink dot com
----
Very short function I made to turn arrays into a string for fwriting, doesnt create unnecessary
commas either:
<?
function arraytostring($array){
$text.="array(";
$count=count($array);
foreach ($array as $key=>$value){
$x++;
if (is_array($value)) {$text.=$key."=>".arraytostring($value); continue;}
$text.="\"$key\"=>\"$value\"";
if ($count!=$x) $text.=",";
}
$text.=")";
return $text;
}
?>