note 25267 added to function.var-export
| From: | samstealth at yahoo dot com | Date: | Tue, 17 Sep 2002 15:40:18 +0000 |
| Subject: | note 25267 added to function.var-export | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-36842@lists.php.net to get a copy of this message | ||
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
--
http://www.php.net/manual/en/function.var-export.php
http://master.php.net/manage/user-notes.php?action=edit+25267
http://master.php.net/manage/user-notes.php?action=delete+25267
http://master.php.net/manage/user-notes.php?action=reject+25267