How do you delete an element from a PHP array?
To delete an element from a PHP array, you call the unset
function like this:
$arr = [
"key1" => "value1",
"key2" => "value2"
];
unset($arr["key2"]);
Unset also allows you to “undefine” a variable
$bob = true ;
unset($bob);
if (isset($bob)) {
// nope
}