how to print array variable in 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
foreach($results as $result) {
echo $result . '<br>';
}