It seems like a fairly trivial task, and such a function should be built into PHP’s core — but unfortunately, it’s not. So we have to find our own solutions for implementing this functionality. One such solution for removing an array element by its value is shown below:
if(($delete_key = array_search($search_value, $my_array)) !== false)
{
unset($my_array[$delete_key]);
}You could say it’s just two lines — and the functionality is ready.


