src/Support/Arr.php
/**
	 * Remove one or many array items from a given array using "dot" notation.
	 *
	 * @param array $array
	 * @param array|string $keys
	 * @return void
	 */
Remove one or many array items from a given array using "dot" notation.
Remove one or many array items from a given array using " dot " notation .
public static function forget(&$array, $keys) {
		$original = &$array;
		$keys = (array)$keys;
		if (count($keys) === 0) {
			return;
		}
		foreach ($keys as $key) {
			if (static::exists($array, $key)) {
				unset($array[$key]);
				continue;
			}
			$parts = explode('.', $key);
			$array = &$original;
			while (count($parts) > 1) {
				$part = array_shift($parts);
				if (isset($array[$part]) && is_array($array[$part])) {
					$array = &$array[$part];
				}
				else {
					continue 2;
				}
			}
			unset($array[array_shift($parts)]);
		}
	}
public static function forget ( & $ array , $ keys ) { $ original = & $ array ; $ keys = ( array ) $ keys ; if ( count ( $ keys ) === 0 ) { return ; } foreach ( $ keys as $ key ) { if ( static :: exists ( $ array , $ key ) ) { unset ( $ array [ $ key ] ) ; continue ; } $ parts = explode ( '.' , $ key ) ; $ array = & $ original ; while ( count ( $ parts ) > 1 ) { $ part = array_shift ( $ parts ) ; if ( isset ( $ array [ $ part ] ) && is_array ( $ array [ $ part ] ) ) { $ array = & $ array [ $ part ] ; } else { continue 2 ; } } unset ( $ array [ array_shift ( $ parts ) ] ) ; } }
Remove one or many array items from a given array using "dot" notation.
Remove one or many array items from a given array using " dot " notation .