Toggle navigation
Home
Latest pastes
FAQ
Random
Register
Login
Using a user-made function to change the values of an array:
SUBMITTED BY:
henry1874w
DATE:
June 23, 2017, 9:42 p.m.
FORMAT:
Text only
SIZE:
169 Bytes
Raw
Download
Tweet
HITS:
328
Go to comments
Report
<?php
function myfunction($v)
{
if ($v==="Dog")
{
return "Fido";
}
return $v;
}
$a=array("Horse","Dog","Cat");
print_r(array_map("myfunction",$a));
?>
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus