Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Send each value of an array to a function, multiply each value by itself, and return an array with the new values:
SUBMITTED BY:
henry1874w
DATE:
June 23, 2017, 9:40 p.m.
FORMAT:
Text only
SIZE:
120 Bytes
Raw
Download
Tweet
HITS:
396
Go to comments
Report
<?php
function myfunction($v)
{
return($v*$v);
}
$a=array(1,2,3,4,5);
print_r(array_map("myfunction",$a));
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus