Returning values

Values are returned by using the optional return statement. Any type may be returned, including lists and objects.

function square ($num) {
    return $num * $num;
echo square (4);   // outputs '16'.

You can't return multiple values from a function, but similar results can be obtained by returning a list.

function small_numbers() {
   return array (0, 1, 2);
list ($zero, $one, $two) = small_numbers();