PHP Program to delete an array element unset()
<?php
$array = array(0 => "apple", 1 => "banana", 2 => "carrot");
//unset the second element of array
unset($array[1]);
//Print the array
echo $array; // Output: (0 => "apple", 2 => "carrot")
?>
Output:
(0 => "apple", 2 => "carrot")
