Answers for "remove id from index array in php"

PHP
16

php remove item array

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

unset($items[0]);

var_dump($items); // ['apple']
Posted by: Guest on March-20-2020
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

Code answers related to "remove id from index array in php"

Browse Popular Code Answers by Language