I have the array:
$array=array('red'=>12,'blue'=>14,'violet'=>88,'green'=>58);
Now I want to remove all values of the array starting from the key ‘violet’. So I can get an array equivalent to:
$array=array('red'=>12,'blue'=>14);
How can I achieve this goal, without looping all the array?
Thanks a lot!
array_slice(), array_search(), array_keys()