Using The Array_Map() Function

<?phpphp    function my_callback($var) {        echo "Value: $var<br />";
        return strtoupper($var);    }    $myarray = array("hello", "this", "is", "a", "callback!");
    $newarray = array_map("my_callback", $myarray);    echo "<pre>";
    print_r($newarray);
    echo "

“;
?>

Enjoyed this post? Share it!

 

Leave a comment

Your email address will not be published.