echo an array code example
Example 1: php echo array
<?php
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
?>
Example 2: php echo array
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
Example 3: dsiplay array on php
$array = array(
1 => 'apple',
2 => 'banana',
)
echo "<pre>";
print_r($array);
echo "</pre>";
echo "<pre>";
var_dump($array);
echo "</pre>";
pr ($array);
Example 4: php echo array
foreach($results as $result) {
echo $result . '<br>';
}
Example 5: php echo array
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>