It looks like the extract() function will be the best tool for what you are trying to do (assuming it extracts all the keys / values ββfrom the array and assign them to variables with the same names as the keys in the local area). After you extracted the contents, you could disable the entire $post , assuming that it does not contain anything that you wanted.
However, to answer your question, you can create an array of keys that you want to delete and execute a loop by explicitly disabling them ...
$removeKeys = array('name', 'email'); foreach($removeKeys as $key) { unset($arr[$key]); }
... or you can point the variable to a new array that deleted the keys ...
$arr = array_diff_key($arr, array_flip($removeKeys));
... or pass all array elements to unset() ...
unset($arr['name'], $arr['email']);
alex Oct 25 '11 at 5:20 2011-10-25 05:20
source share