<?php
function show_Spanish($n, $m)
{
return "The number {$n} is called {$m} in Spanish";
}
function map_Spanish($n, $m)
{
return [$n => $m];
}
$a = [1, 2, 3, 4, 5];
$b = ['uno', 'dos', 'tres', 'cuatro', 'cinco'];
$c = array_map('show_Spanish', $a, $b);
print_r($c);
$d = array_map('map_Spanish', $a , $b);
print_r($d);
?>
// printout of $c
Array
(
[0] => The number 1 is called uno in Spanish
[1] => The number 2 is called dos in Spanish
[2] => The number 3 is called tres in Spanish
[3] => The number 4 is called cuatro in Spanish
[4] => The number 5 is called cinco in Spanish
)
// printout of $d
Array
(
[0] => Array
(
[1] => uno
)
[1] => Array
(
[2] => dos
)
[2] => Array
(
[3] => tres
)
[3] => Array
(
[4] => cuatro
)
[4] => Array
(
[5] => cinco
)
)