Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

PHP Return Array

With PHP, you can return a variable or an array from a function. The example below demonstrates how to return a simple array.

<?php
function people(){
    $myarray = array(‘jane’,’bob’,’mike’,’phil’);
    print_r($myarray);
    return $myarray;
}

//The function will make variable called $mytotal which can be returned from the function
$total = people();
echo “<br/><br/>”;

//$total is setting the variable equal to the function
//The value $mytotal is returned and is printed below
echo “The array are the people $total[0], $total[1], $total[2] and $total[3].”;
?>