how to output array in php code example
Example 1: php echo array
$a = array ('a' => 'apple', 'b' => 'banana', 'c' => array ('x', 'y', 'z'));
print_r ($a);
Example 2: 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 3: print array in php
print_r($array);