Send each value in array to a function, and return an array with the new values in PHP
Description
The following code shows how to send each value in array to a function, and return an array with the new values.
Example
//from w w w .j a v a2 s.c om
<?php
function myfunction($v){
return($v*$v);
}
$a=array(1,2,3,4,5);
print_r(array_map("myfunction",$a));
?>
The code above generates the following result.