lithium\util\Set::remove()
Removes an element from an array as defined by $path
.
Parameters
-
mixed
$list
From where to remove.
-
mixed
$path
A dot-delimited string.
Returns
arrayArray with $path
removed from its value.
Source
public static function remove($list, $path = null) {
if (empty($path)) {
return $list;
}
if (!is_array($path)) {
$path = explode('.', $path);
}
$_list =& $list;
foreach ($path as $i => $key) {
if (is_numeric($key) && (integer) $key > 0 || $key === '0') {
$key = (integer) $key;
}
if ($i === count($path) - 1) {
unset($_list[$key]);
} else {
if (!isset($_list[$key])) {
return $list;
}
$_list =& $_list[$key];
}
}
return $list;
}