$array = array(1, 2, 3, 4, 5); $delete = array(2, 4); $result = array_diff($array, $delete); print_r($result);
$array = array("apple", "banana", "orange", "pear"); $delete = array(1, 2); foreach ($delete as $key) { unset($array[$key]); } print_r($array);This code will delete the elements with keys 1 and 2 from the array and output the result as an array with elements "apple" and "pear". In both examples, the function used to delete the elements is `array_diff()` and `unset()`. These functions are part of the PHP Standard Library, which means that they are included in the PHP package by default.