note 80177 deleted from ref.array by levim
| From: | levim@php.net | Date: | Tue, 06 May 2014 22:09:11 +0000 |
| Subject: | note 80177 deleted from ref.array by levim | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-199466@lists.php.net to get a copy of this message | ||
Note Submitter: chaos dot global dot net at gmail dot com
----
if some one will need to convert array to php code use this function:
DEFINE('OFFSET_DELIMETER', "\t");
function array2php($array, $offset = OFFSET_DELIMETER) {
$text = '';
foreach($array as $k => $v) {
if (is_array($v)) {
$text .= "{$offset}'{$k}' => array(\n".array2php($v,
$offset.OFFSET_DELIMETER)."$offset)";
} else {
$text .= "{$offset}'{$k}' => ".(is_string($v)?
"'$v'": $v);
}
$text .= ",\n";
}
if ($len = strlen($text)) $text[$len - 2] = " ";
return $text;
}