I need to remove from an array some keys.
$array = array('a' => 'a', 'b' => 'b', 'c' => 'c');
unset($array['a']);
unset($array['b']);
How can I do this more elegance? Maybe there is a function like this array_keys_unset('a', 'b')
?
I don't need array_values
or foreach
. I only want to know is it possible.
Thank you in advance. Sorry for my english and childlike question.
You can do that with single call to unset
as:
unset($array['a'],$array['b']);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With