public static function forget(&$array, $keys)
    {
        $original =& $array;

        foreach ((array) $keys as $key)
        {
            $parts = explode('.', $key);

            while (count($parts) > 1)
            {
                $part = array_shift($parts);

                if ((is_array($array) && isset($array[$part]) && is_array($array[$part])) ||
                    (is_object($array) && isset($array->{$part}) && is_array($array->{$part})))
                {
                    if (is_array($array)) $array =& $array[$part];
                    elseif (is_object($array)) $array =& $array->{$part};
                }
            }

            $part = array_shift($parts);

            if (is_array($array)) unset($array[$part]);
            elseif (is_object($array)) unset($array->{$part});

            // clean up after each pass
            $array =& $original;
        }
    }
public static function forget(&$array, $keys)
    {
        $original =& $array;

        foreach ((array) $keys as $key)
        {
            $parts = explode('.', $key);

            while (count($parts) > 1)
            {
                $part = array_shift($parts);

                if ((is_array($array) && isset($array[$part]) && is_array($array[$part])) ||
                    (is_object($array) && isset($array->{$part}) && is_array($array->{$part})))
                {
                    if (is_array($array)) $array =& $array[$part];
                    elseif (is_object($array)) $array =& $array->{$part};
                }
            }

            $part = array_shift($parts);

            if (is_array($array)) unset($array[$part]);
            elseif (is_object($array)) unset($array->{$part});

            // clean up after each pass
            $array =& $original;
        }
    }
public static function forget ( & $ array , $ keys ) { $ original = & $ array ; foreach ( ( array ) $ keys as $ key ) { $ parts = explode ( '.' , $ key ) ; while ( count ( $ parts ) > 1 ) { $ part = array_shift ( $ parts ) ; if ( ( is_array ( $ array ) && isset ( $ array [ $ part ] ) && is_array ( $ array [ $ part ] ) ) || ( is_object ( $ array ) && isset ( $ array -> { $ part } ) && is_array ( $ array -> { $ part } ) ) ) { if ( is_array ( $ array ) ) $ array = & $ array [ $ part ] ; elseif ( is_object ( $ array ) ) $ array = & $ array -> { $ part } ; } } $ part = array_shift ( $ parts ) ; if ( is_array ( $ array ) ) unset ( $ array [ $ part ] ) ; elseif ( is_object ( $ array ) ) unset ( $ array -> { $ part } ) ; // clean up after each pass $ array = & $ original ; } }
Remove one or many array items from a given array using "dot" notation.

@param  array|object $array
@param  array|string $keys

@return void
Remove one or many array items from a given array using dot notation .