<?php
function getArray()
{
echo 'getArray was called.</br>';
return array(1,2,3,4,5,6);
}
// test for assigning the array return in a variable
echo '1st test</br>';
$arr = getArray();
foreach ($arr as $val) {
echo $val;
}
echo '</br></br>2nd test</br>';
// test for getting the array inside the foreach iterator
foreach (getArray() as $val) {
echo $val;
}