PHP 8.5.8 Released!

Voting

: seven minus one?
(Example: nine)

The Note You're Voting On

amoffat at amoffat dot com
18 years ago
<?
function my_array_map() {
    $args = func_get_args();
    $arr = array_shift($args);
    
    foreach ($args as $fn) {
        $nfn = create_function('&$v, $k, $fn', '$v = $fn($v);');
        array_walk_recursive($arr, $nfn, $fn);
    }
    return $arr;
}
?>

takes an array as the first argument, and functions as the other arguments.  it applies those functions recursively to the array

<< Back to user notes page

To Top