How to View Array Contents in PHP
You cannot view the entire contents of an array using
echo. If you try to do this,
the word Array will simply be displayed on the screen:
<?php
$a = [1, 2, 3];
echo $a; // will output 'Array'
?>
To make PHP display all the elements of
the array, you need to use the function var_dump:
<?php
$a = [1, 2, 3];
var_dump($a);
?>
Given an array:
<?php
$a = ['a', 'b', 'c'];
?>
Display this array on the screen using
the command echo and using
the function var_dump.