note 70405 deleted from function.print-r by bjori

From: Date: Sun, 15 Oct 2006 13:11:36 +0000
Subject: note 70405 deleted from function.print-r by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-118546@lists.php.net to get a copy of this message
Note Submitter: luiscubal at gmail dot com Reason: useless ---- <?php /* I hate to insert <pre></pre>, so I decided to make my own print_r. void myprint_r(array $array [, string $line [, string indented [, int indent] ] ]) PREDEFINED string line: "<br>" string indented: "&emps;" int indent: 0 To turn off the indent, place an empty string in &emps; */ function myprint_r($array, $line = "<br>", $indented = "&emps;", $indent = 0){ $z = array_keys($array); $t = 0; while($z[$t]){ $d = $z[$t]; if(is_array($array[$d])){ echo '[' . $d . '] = array' . $line; myprint_r($array[$d],$line,$indented, $indent + 1); } else{ $p = 0; while($p<$indent){ echo "&emsp;"; $p++; } echo '[' . $d . '] = ' . $array[$d] . $line; } $t++; } } $hello["Hi"] = 2; $hello[2] = 3; $hello[9] = 4; $x[1] = "V"; $x[2] = "E"; $hello["Neo"] = $x; myprint_r($hello); ?>

« previous php.notes (#118546) next »