On Windows machines
we should have to put one echo '<pre>'; before the
[man]print_r[/man]
I use often [man]var_export[/man]
because it gives a very nice output.
The third option to display an array is [man]var_dump[/man]
This gives more detailed information.
Run this DEMO to see the 3 different options in action 🙂
<?php
$arr = array('a'=>1,'b'=>2,'c'=>3,'d'=>4);
// print_r()
echo '<pre>';
print_r($arr);
echo '</pre>';
echo '<hr />';
// var_export()
echo '<pre>';
var_export($arr);
echo '</pre>';
echo '<hr />';
//var_dump()
echo '<pre>';
var_dump($arr);
echo '</pre>';
?>