I implemented array_map() as follows:
$example = array(' [email protected]', '[email protected] ');
$result = array_map(function($email) {
return trim($email);
}, $example);
// $result now has each item trimmed
// IE: '[email protected]', '[email protected]' ..
This got me to wondering...
Q How exactly is array_map() working behind the scenes?
You can also explain this way by using a closure to a function :