Print an Array in PHP
Printing an array can be quite useful when debugging your PHP code and luckily PHP makes the task simple.
The print_r(array) function takes any array as an argument and iterates through it, printing the results to standard out as it goes.
For example:
<?php
$myArray = array("One", "Two", "Three");
print_r($myArray);
?>
The above code will display the contents of $myArray.
Trackback URL for this post:
http://www.farbyte.com/blog/trackback/5

Comments
Post new comment