note 70405 added to function.print-r

From: Date: Sun, 15 Oct 2006 11:34:54 +0000
Subject: note 70405 added to function.print-r
Groups: php.notes 
Request: Send a blank email to php-notes+get-118544@lists.php.net to get a copy of this message
<?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); ?> ---- Server IP: 81.92.200.26 Probable Submitter: 82.155.153.20 ---- Manual Page -- http://www.php.net/manual/en/function.print-r.php Edit -- https://master.php.net/note/edit/70405 Del: integrated -- https://master.php.net/note/delete/70405/integrated Del: useless -- https://master.php.net/note/delete/70405/useless Del: bad code -- https://master.php.net/note/delete/70405/bad+code Del: spam -- https://master.php.net/note/delete/70405/spam Del: non-english -- https://master.php.net/note/delete/70405/non-english Del: in docs -- https://master.php.net/note/delete/70405/in+docs Del: other reasons-- https://master.php.net/note/delete/70405 Reject -- https://master.php.net/note/reject/70405 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#118544) next »