Unsetting an Array Element in PHP


Remove an element from an array using unset().

Source Code

$array = ["apple", "banana", "cherry"];
unset($array[1]); // Removes "banana" from the array
print_r($array);
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments