Answers for "php remove from arrays"

PHP
16

php remove item array

$items = ['banana', 'apple'];

unset($items[0]);

var_dump($items); // ['apple']
Posted by: Guest on March-20-2020
2

php remove string from array

$index = array_search('string3',$array);
if($index !== FALSE){
    unset($array[$index]);
}
Posted by: Guest on November-07-2021

Code answers related to "php remove from arrays"

Browse Popular Code Answers by Language