public static function update(array $array, string $key, callable $callback)
    {
        $keys = explode('.', $key);
        $current = &$array;

        foreach ($keys as $key) {
            if (! isset($current[$key])) {
                return $array;
            }

            $current = &$current[$key];
        }

        $current = $callback($current);

        return $array;
    }
public static function update(array $array, string $key, callable $callback)
    {
        $keys = explode('.', $key);
        $current = &$array;

        foreach ($keys as $key) {
            if (! isset($current[$key])) {
                return $array;
            }

            $current = &$current[$key];
        }

        $current = $callback($current);

        return $array;
    }
public static function update ( array $ array , string $ key , callable $ callback ) { $ keys = explode ( '.' , $ key ) ; $ current = & $ array ; foreach ( $ keys as $ key ) { if ( ! isset ( $ current [ $ key ] ) ) { return $ array ; } $ current = & $ current [ $ key ] ; } $ current = $ callback ( $ current ) ; return $ array ; }
Updates data at the given path.

@param array    $array
@param sting    $key
@param callable $callback Callback to update the value.

@return mixed Updated data.
Updates data at the given path .