Remove element from array in PHP
php delete item from array
if (in_array('strawberry', $array))
{
unset($array[array_search('strawberry',$array)]);
}
php remove element from array
$array = [0 => "a", 1 => "b", 2 => "c",3=>"d"];
//Params are: array,index to delete,number of elements to remove
array_splice($array, 2, 1);
//print_r($array);
//Array
//(
// [0] => a
// [1] => b
// [2] => d
//)