Printing the contents of a PHP Array
This is a pretty common task, but it's surprising how many PHP newbies don't know about it yet. If you want to see the structure of your PHP Array, all you need to do is this:
print_r($myarray);
This will give you a listing of all the items in the array, including multi-dimensional arrays. Obviously this should only be used for testing / debugging purposes.
The Geek is the founder of How-To Geek and a geek enthusiast. When he's not coming up with great how-to articles, he's probably writing at his personal blog. This article was written on 09/26/06 and tagged with: Programming, PHP


and if you like it human-readable:
echo ""; print_r($myarray); echo "";
have fun!
this is more human-readable :
echo '';
print_r($array);
echo '';
You may want to try this:
echo "";
print_r($location);
echo "";
echo "(html open tag)pre(html close tag)";
print_r($location);
echo "\";
echo "(less than sign)pre(greater than sign)";
print_r($location);
echo "(less than sign)/pre(greather than sign)";
between the quotes are the html pre tags (open and then close).