Higher-order functions: Difference between revisions
Content deleted Content added
No edit summary |
|||
Line 103:
return(reverse(shift));
}
==[[PHP]]==
[[Category:PHP]]
In this simple example, an array of two values is passed and the statistical average is computed.
function average($arry) {
$tmp = ($arry[0] + $arry[1]) / 2;
return $tmp;
}
To call it:
$array1 = ( 5, 15 );
echo "The average is ".average($arrayl)."\n";
==[[Python]]==
|