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$arr = array('a' => 1, 'b' => 2, 'c' => 3);
2unset($arr['b']);
3
4// RESULT: array('a' => 1, 'c' => 3)
5
6$arr = array(1, 2, 3);
7array_splice($arr, 1, 1);
8
9// RESULT: array(0 => 1, 1 => 3)