How do I remove a specific element from an array using PHP.
In this tutorial, you will learn two PHP unset() and array_splice() methods to remove specific array elements.
Use the PHP unset() function to delete an element from an array.
Basically it is used to unset any variable in PHP. This function accept variable as argument and unset it.
Example:
<?php
$arr = array("a" => "apple", "b" => "ball", "c" => "cat");
unset($arr["b"]);
?>
Output:
array("a" => "Apple", "c" => "Cat")
#php #array #programming