Return to Snippet

Revision: 47694
at June 14, 2011 12:12 by bretticus


Initial Code
if (!function_exists('array_replace')) {

    /**
     * Emulate PHP 5.3 function
     * 
     * @return type array
     */
    function array_replace() {
        $arrays = func_get_args();
        for($i=1; $i<count($arrays); $i++){
            if ( !is_array($arrays[$i]) )
                continue;
            foreach ($arrays[$i] as $key => $value) {
                $arrays[0][$key] = $value;
            }
        }
        return $arrays[0];
    }

}

Initial URL

                                

Initial Description
Emulate native PHP 5.3 function.

Initial Title
array_replace for  PHP

Initial Tags

                                

Initial Language
PHP