I usually use foreach loop to remove some items from array.
foreach($array as $key=>$item){
if($item == 'something'){
unset($array[$key]);
}
}
Is this possible to remove items via array_walk or array_filter?
$newarray = array_filter($array, function($var) {
return ($var != 'something');
});
$newarray = array_filter($array, function($key) { return preg_match('/something/', $key); }, ARRAY_FILTER_USE_KEY); or function($value, $key) with the ARRAY_FILTER_USE_BOTH flag if the condition is looking at both key and value.