Answers for "how to remove value in array using value in php"

PHP
14

php delete element from array

//Delete array items with unset(no re-index) or array_splice(re-index)
$colors = array("red","blue","green");                             
unset($colors[1]);//remove second element, do not re-index array

$colors = array("red","blue","green");
array_splice($colors, 1, 1); //remove second element, re-index array
Posted by: Guest on August-06-2019
0

php remove element from array by value

// matrix array
foreach($appsList as $key => $app) {
            if($app["app_status"] !== "approved") {
                // remove orange apps
                unset($appsList[$key]);
            }
}
Posted by: Guest on January-15-2021

Code answers related to "how to remove value in array using value in php"

Browse Popular Code Answers by Language