Recursively unset an array key
This function takes an array and a key that is unwanted. It will recurse through and unset the key in the argument array and all its sub-arrays.
Copy this code and paste it in your HTML
function recursive_unset(&$array, $unwanted_key) {
unset($array[$unwanted_key]); foreach ($array as &$value) {
recursive_unset($value, $unwanted_key);
}
}
}
Report this snippet
Comments
Subscribe to comments