Q:

How to display array structure and values in PHP

0

How to display array structure and values in PHP

All Answers

need an explanation for this answer? contact us directly to get an explanation for this 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:

<?php
$cities = array("London", "Paris", "New York");
 
// Print the cities array
Print_r($cities);
echo "<hr>";
var_dump($cities);
?>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now