Answers for "remove an array from array in php"

PHP
23

php delete array item by value

$colors = array("blue","green","red");

//delete element in array by value "green"
if (($key = array_search("green", $colors)) !== false) {
    unset($colors[$key]);
}
Posted by: Guest on October-30-2019
7

php delete item from array

if (in_array('strawberry', $array)) 
{
    unset($array[array_search('strawberry',$array)]);
}
Posted by: Guest on November-10-2021

Code answers related to "remove an array from array in php"

Browse Popular Code Answers by Language