Answers for "if value null so unset key in array in php"

PHP
23

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
1

how to remove NULL values in array PHP

array_filter();
Posted by: Guest on January-23-2021

Browse Popular Code Answers by Language