How to display array structure and values in PHP
Topic: PHP / MySQLPrev|Next
Answer: Use the PHP print_r() or var_dump() Statement
You can either use the PHP print_r() or var_dump() statement to see or check the structure and values of an array in human-readable format on the screen. The var_dump() statement however gives more information than print_r(). Let's see how it basically works:
Example
Try this code »<?php
$cities = array("London", "Paris", "New York");
// Print the cities array
Print_r($cities);
echo "<hr>";
var_dump($cities);
?>
Related FAQ
Here are some more FAQ related to this topic:

