<?php $cars = [ [ 'Volvo', 22, 28 ], // index 0 [ 'BMW', 15, 13 ], // index 1 [ 'Land Rover', 3, 8 ], // index 2 [ 'Add Cars', 'X', 'Y' ] // index i ]; $i = count($cars) -1; // get current last set in the array unset($cars[0]); // unset Volvo unset($cars[1]); // unset BMW unset($cars[$i]); // unset index # the only index not unset is 2 (Land Rover) so it should only be left inside the array print_r($cars);
You have javascript disabled. You will not be able to edit any code.