Arrays
|
|
|
|
<?
/*
Function coded by Stephan Pirson
contact: saibot@hesperia-mud.org
*/
function print_a( $TheArray )
{ // Note: the function is recursive
echo "<table border=1>n";
$Keys = array_keys( $TheArray );
foreach( $Keys as $OneKey )
{
echo "<tr>n";
echo "<td bgcolor='#727450'>";
echo "<B>" . $OneKey . "</B>";
echo "</td>n";
echo "<td bgcolor='#C4C2A6'>";
if ( is_array($TheArray[$OneKey]) )
print_a($TheArray[$OneKey]);
else
echo $TheArray[$OneKey];
echo "</td>n";
echo "</tr>n";
}
echo "</table>n";
} ?>
|
|
|
Usage Example
|
Give it this to eat and compare with print_r:
$testa = Array( "blah" => 1, "Blah2" => Array ( 1, 2, 3, "Hmmm" => "Sure", Array(2, 1, Array( "count" => 2), 1 ), 8 ), "Blah3" => 3, "An Array" => Array("Test"=>1, "Test2" => 2, "Test3" => Array( "blah", 3, "someone1" => "me", 7 ) ) );
print_a($testa);
|
|
|
Rate This Script
|
|
|
|