Answers for "how to remove the key into number in key and value in array in 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

Code answers related to "how to remove the key into number in key and value in array in php"

Browse Popular Code Answers by Language