Removing Elements from Arrays
This lesson discusses an important array operation, i.e., removing elements from an array.
We'll cover the following...
PHP built-in function unset()
is used to remove an element from an array.
Removing Elements from Indexed Arrays #
Specifying an array element as an input parameter for unset()
will remove that element from an indexed array. Below is the code for removing an element at index 1
in the array $fruit
: