Answers for "remove certain key from array in php 8"

PHP
21

php delete array item by value not key

$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 "remove certain key from array in php 8"

Browse Popular Code Answers by Language