How to Remove a Key and its Value from an Associative Array in PHP
In this lesson, we will see how to remove a key and its value from an associative array in PHP, an Associative array is an array that uses a named key that you assign to a value.
Remove a key and its value from an associative array
The example below shows how you can remove a key and its value from an associative array in PHP.
$notes = array("jack" => 12, "john" => 15, "sam" => 4);
unset($notes["jack"], $notes["sam"]);
print_r($notes);
//Array ( [john] => 15 )