How to print or output the contents of a PHP Array.
This is a common task for every php developer. You can simply use the following function:
print_r($myarray);
This will give you a listing of all the items in the array. (Including multi-dimensional arrays).
For example:
<?php 'Adam', 'b' => 'Bruce', 'c' => array ('Chris', 'Cathy')); print_r ($Names); ?>
The results would be something like:
Array ( [a] => Adam [b] => Bruch [c] => Array ( [0] => Chris [1] => Cathy ) )
Log in to answer.
smallwei 2:01 pm on October 27, 2009
This is a common task for every php developer. You can simply use the following function:
print_r($myarray);This will give you a listing of all the items in the array. (Including multi-dimensional arrays).
For example:
The results would be something like: