Function Seven
Before to function seven
Array ( )
This is inside Function seven()
After function seven
Array ( [0] => 10 [1] => 11 [2] => 12 [3] => 13 [4] => 14 [5] => 15 [6] => 16 [7] => 17 [8] => 18 [9] => 19 )
Before to function seven
Array ( )
This is inside Function seven()
After function seven
Array ( [0] => 10 [1] => 11 [2] => 12 [3] => 13 [4] => 14 [5] => 15 [6] => 16 [7] => 17 [8] => 18 [9] => 19 )
<?php
include('includes/header1.php');
// code
error_reporting(E_ALL); // set error reporting to all
echo('<h1>Function Seven</h1>');
//============= functions ===============
// function seven
// a function that receives an array, populates that array, and returns those values
// to an array
function seven($a)
{
echo("<p>This is inside Function seven() </p>");
for($i = 0; $i < 10; $i++)
{
$a[$i] = $i + 10; // NOTE the [] where the index is automagically generated
}
return $a; // note the return
}
$a = array(); // init an array
echo("<p>Before to function seven</p>");
echo('<pre>');
print_r($a);
echo('</pre>');
$a = seven($a); // call to function seven
echo("<p>After function seven</p>");
echo('<pre>');
print_r($a);
echo('</pre>');
include('includes/footer1.php');
?>