note 10684 deleted from function.each by irc-html

From: Date: Sat, 19 Jan 2002 21:52:17 +0000
Subject: note 10684 deleted from function.each by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25494@lists.php.net to get a copy of this message
I use this as a debugging function, it prints out an entire array (all it's dimentions too!) function ListArray($var, $title='ListArray') { if($title){ $string = ''; } $string .= '<table border="0" cellpadding="2" cellspacing="1" bgcolor="CCCCCC" style="font-size: 10px;">'; if($title){ $string .= '<tr bgcolor="003346" style="color: whitesmoke;"><td><b>Key</b></td><td><b>Value</b></td></tr>'; } while(list($key, $val) = each($var)) { $string .= '<tr bgcolor="whitesmoke">' ; $string .= "<td valign=\"top\"><b>$key</b></td><td valign=\"top\">"; if(is_array($val)){ $string .= ListArray($val, ''); }else{ $string .= "$val" ; } $string .= '</td></tr>'; }//While $string .= "</table>"; if($title){ $string .= ''; } return $string; } $TheArray[1] = 'foo'; $TheArray['bob']] = 'is cool'; ListArray($TheArray);

« previous php.notes (#25494) next »