1$items = ['banana', 'apple'];
2
3unset($items[0]);
4
5var_dump($items); // ['apple']
1//Delete array items with unset(no re-index) or array_splice(re-index)
2$colors = array("red","blue","green");
3unset($colors[1]);//remove second element, do not re-index array
4
5$colors = array("red","blue","green");
6array_splice($colors, 1, 1); //remove second element, re-index array
1$array = [0 => "a", 1 => "b", 2 => "c"];
2unset($array[1]); //Key which you want to delete
3/*
4$array:
5[
6 [0] => a
7 [2] => c
8]
9*/
10//OR
11$array = [0 => "a", 1 => "b", 2 => "c"];
12array_splice($array, 1, 1);//Offset which you want to delet
13/*
14$array:
15[
16 [0] => a
17 [1] => c
18]
19*/