Simple one, I was just wondering if there is a clean and eloquent way of returning all values from an associative array that do not match a given key(s)?
$array
Use array_diff_key():
array_diff_key()
$array = array('alpha' => 'apple', 'beta' => 'banana', 'gamma' => 'guava'); $alphaAndGamma = array_diff_key($array, array('alpha'=>0)); $onlyBeta = array_diff_key($array, array('alpha'=>0, 'gamma'=>0));
EDIT: I added =>0s.