Answers for "php remove array if value exists"

PHP
0

php array remove value if exists

<?php
$myArray = array ('Alan', 'Peter', 'Linus', 'Larry');
$pos = array_search('Linus', $myArray);
echo 'Linus found at: '.$pos;
// Remove from array
unset($myArray[$pos]);
print_r($myArray);
?>
Posted by: Guest on April-07-2021
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 "php remove array if value exists"

Browse Popular Code Answers by Language