Answers for "php unset key from array and return whole array"

PHP
17

php delete element 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

unset by key name php

unset($array['key-here']);
Posted by: Guest on April-28-2020

Browse Popular Code Answers by Language