Answers for "delete an entire array php"

PHP
17

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
12

php remove item array

$items = ['banana', 'apple'];

unset($items[0]);

var_dump($items); // ['apple']
Posted by: Guest on March-20-2020

Code answers related to "delete an entire array php"

Browse Popular Code Answers by Language