note 104080 added to function.serialize
| From: | coolesting at gmail dot com | Date: | Sat, 21 May 2011 14:04:49 +0000 |
| Subject: | note 104080 added to function.serialize | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-179926@lists.php.net to get a copy of this message | ||
Hi, guys, i have a good function to render the array to a string as that original array, this is
very useful to be strong into php-script and database. if any problem, calling me with
coolesting@gmail.com
function c_arr2str($arr, $first = TRUE) {
static $string = '';
$string .= "array(";
if (count($arr)) {
foreach ($arr as $key => $val){
if (!is_array($val)) {
$string .= "'$key' => '$val',";
} else {
$string .= "'$key' => ";
c_arr2str($val, FALSE);
}
}
}
$string .= "),";
if ($first) $string = substr($string, 0 , -1) . ';';
return $string;
}
----
Server IP: 222.73.207.145
Probable Submitter: 127.0.0.1 (proxied: 58.248.98.229)
----
Manual Page -- http://www.php.net/manual/en/function.serialize.php
Edit -- https://master.php.net/note/edit/104080
Del: integrated -- https://master.php.net/note/delete/104080/integrated
Del: useless -- https://master.php.net/note/delete/104080/useless
Del: bad code -- https://master.php.net/note/delete/104080/bad+code
Del: spam -- https://master.php.net/note/delete/104080/spam
Del: non-english -- https://master.php.net/note/delete/104080/non-english
Del: in docs -- https://master.php.net/note/delete/104080/in+docs
Del: other reasons-- https://master.php.net/note/delete/104080
Reject -- https://master.php.net/note/reject/104080
Search -- https://master.php.net/manage/user-notes.php