note 49653 deleted from function.var-export by aidan

From: Date: Sun, 01 May 2005 04:58:30 +0000
Subject: note 49653 deleted from function.var-export by aidan
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-88809@lists.php.net to get a copy of this message
Note Submitter: adam at gotlinux dot us ---- 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; } ?>

« previous php.notes (#88809) next »