Change all letters of the array values to uppercase with array_map in PHP
Description
The following code shows how to change all letters of the array values to uppercase with array_map.
Example
/*w ww .j a v a 2s . c o m*/
<?php
function myfunction($v) {
$v=strtoupper($v);
return $v;
}
$a=array("Animal" => "horse", "Type" => "mammal");
print_r(array_map("myfunction",$a));
?>
The code above generates the following result.