Answers for "php clean certain results from array"

PHP
23

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
0

how remove empty value in array php

<?php
$array = array("apple", "", 0, 2, null, -5, "0", "orange", 10, false);
var_dump($array);
echo "<br>";
 
// Filtering the array
$result = array_filter($array);                 
var_dump($result);
?>
Posted by: Guest on March-13-2022

Code answers related to "php clean certain results from array"

Browse Popular Code Answers by Language