remove key and value from array php
snippet in php

php delete element by value

user2058

$colors = array("blue","green","red");

//delete element in array by value "green"
if (($key = array_search("green", $colors)) !== false) {
    unset($colors[$key]);
}

php unset array key

user1217

unset($dataArray['key']);

remove key and value from array php

user1701

$arr = array('G', 'E', 'E', 'K', 'S');  
unset($arr[2]);
print_r($arr);