echo array value in php code example
Example 1: php echo arry
echo json_encode($anArray);
Example 2: php echo array
<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
?>
Example 3: php echo array
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
Example 4: php echo array
foreach($results as $result) {
echo $result . '<br>';
}
Example 5: php arrays
$nums = [1, 2, 3, 4, 5];
Example 6: array in php
<?php
$cars = array("Maserati", "Porsche", "BMW");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>