how to print an array of php code example
Example 1: dsiplay array on php
$array = array(
1 => 'apple',
2 => 'banana',
)
// Method 1
echo "<pre>";
print_r($array);
echo "</pre>";
// Method 2
echo "<pre>";
var_dump($array);
echo "</pre>";
// Method 3 (cakephp)
pr ($array);
Example 2: php echo array
<?php
$cars = array("Volvo", "BMW", "Toyota");
echo "I like " . $cars[0] . ", " . $cars[1] . " and " . $cars[2] . ".";
?>