note 50751 added to function.print-r

From: Date: Wed, 09 Mar 2005 01:47:43 +0000
Subject: note 50751 added to function.print-r
Groups: php.notes 
Request: Send a blank email to php-notes+get-86135@lists.php.net to get a copy of this message
string_r is missing variable declarations and should be called sprint_r anyway :) function sprint_r($array, $idt=0) { $tabsize = " "; $arg = func_get_args(); $indent = $idt; if (func_num_args() == 1) $indent = $tabsize; $contentString=""; foreach ($array as $name => $value) { if (is_array($value)) { $contentString .= $indent.'['.$name.'] => Array' . "\n".$indent.$tabsize."(\n"; $contentString .= sprint_r($value, $indent. $tabsize.$tabsize); $contentString .= $indent .$tabsize. ")\n\n"; } else { $contentString .= $indent . '['.$name.']' . ' => ' . $value . "\n"; } } if (func_num_args() == 1) { $contentString = "Array\n(\n" . $contentString . ")\n"; } return $contentString; } ---- Manual Page -- http://www.php.net/manual/en/function.print-r.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50751 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50751&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50751&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50751&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50751&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50751&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50751&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86135) next »