How can you delete a specific element in an array in PHP?
To delete a specific element in an array in PHP, you can use the unset() function. This function allows you to remove a specific element from an array based on its key. You simply need to provide the key of the element you want to delete as an argument to the unset() function.
// Define an array
$fruits = array("apple", "banana", "cherry", "date");
// Delete the element with key 2 (cherry)
unset($fruits[2]);
// Output the modified array
print_r($fruits);