note 28287 added to ref.array

From: Date: Wed, 08 Jan 2003 14:35:22 +0000
Subject: note 28287 added to ref.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-41826@lists.php.net to get a copy of this message
Hi, I took the function from spam (at) speedcapture . com I simplified it just a little, and here is the result. Thanks for sharing this great tool with us. Simple, but sooooo usefull :) function view_array($arr, $td=0) { if ($td) { echo '<td>'; } echo '<table>'; foreach ($arr as $key => $elem) { echo '<tr>'; echo '<td>'.$key.'&nbsp;</td>'; if (is_array($elem)) { view_array($elem, 1); } else { echo '<td>'.htmlspecialchars($elem).'&nbsp;</td>'; } echo '</tr>'; } echo '</table>'; if ($td) { echo '</td>'; } } You call it as you used to: Let $myArray be an array of any kind, simply do view_array($myArray); -- http://www.php.net/manual/en/ref.array.php http://master.php.net/manage/user-notes.php?action=edit+28287 http://master.php.net/manage/user-notes.php?action=delete+28287 http://master.php.net/manage/user-notes.php?action=reject+28287

« previous php.notes (#41826) next »