Answers for "php array remove element by key"

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
5

php unset array key

unset($dataArray['key']);
Posted by: Guest on June-01-2020
0

php array remove key value pair

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

Code answers related to "php array remove element by key"

Browse Popular Code Answers by Language