note 25267 deleted from function.var-export by sniper
| From: | sniper@php.net | Date: | Sun, 28 Sep 2003 22:40:47 +0000 |
| Subject: | note 25267 deleted from function.var-export by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57236@lists.php.net to get a copy of this message | ||
Note Submitter: samstealth@yahoo.com
----
for those unlucky, who use older versions of php. this piece of code should replace var_export():
function var_export($a)
{
$result = "";
switch (gettype($a))
{
case "array":
reset($a);
$result = "array(";
while (list($k, $v) = each($a))
$result .= "$k => ".var_export($v).", ";
$result .= ")";
break;
case "string":
$result = "'$a'";
break;
case "boolean":
$result = ($a) ? "true" : "false";
break;
default:
$result = $a;
break;
}
return $result;
}
kind regards,
sam