note 49653 added to function.var-export
| From: | adam at gotlinux dot us | Date: | Thu, 03 Feb 2005 20:26:49 +0000 |
| Subject: | note 49653 added to function.var-export | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-84483@lists.php.net to get a copy of this message | ||
If for some reason you don't have var_export and
you don't want to use PHP_Compat. This function works nicely.
I wrote this before I found out that var_export existed.
<?php
function print_array($array,$position=0) {
if (is_array($array)) {
$tabs=str_repeat("\t",$position);
$ret.="array(\n";
$position++;
foreach($array as $key=>$values) {
$iaray[]=$tabs."\"".$key."\"=>".
print_array($values,$position);
}
$ret.=join(",\n",$iaray)."\n\t".$tabs;
$ret.=")";
} else {
$ret.="\"".$array."\"";
}
return $ret;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.var-export.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+49653
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+49653&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+49653&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+49653&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+49653&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+49653&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+49653&report=yes
Search -- http://master.php.net/manage/user-notes.php