public static function each(array $set, Closure $callback, $recursive = true) {
        foreach ($set as $key => $value) {
            if (is_array($value) && $recursive) {
                $set[$key] = static::each($value, $callback, $recursive);
            } else {
                $set[$key] = $callback($value, $key);
            }
        }

        return $set;
    }
public static function each(array $set, Closure $callback, $recursive = true) {
        foreach ($set as $key => $value) {
            if (is_array($value) && $recursive) {
                $set[$key] = static::each($value, $callback, $recursive);
            } else {
                $set[$key] = $callback($value, $key);
            }
        }

        return $set;
    }
public static function each ( array $ set , Closure $ callback , $ recursive = true ) { foreach ( $ set as $ key => $ value ) { if ( is_array ( $ value ) && $ recursive ) { $ set [ $ key ] = static :: each ( $ value , $ callback , $ recursive ) ; } else { $ set [ $ key ] = $ callback ( $ value , $ key ) ; } } return $ set ; }
Calls a function for each key-value pair in the set.
If recursive is true, will apply the callback to nested arrays as well.

@param array $set
@param \Closure $callback
@param bool $recursive
@return array
Calls a function for each key - value pair in the set . If recursive is true will apply the callback to nested arrays as well .