3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $messages = array(312, 401, 401, 1599, 3); $del_val = 401; if(($key = array_search($del_val, $messages)) !== false) { unset($messages[$key]); } print_r($messages);
based on X6IuG
Output for 4.3.0 - 7.2.6
Array ( [0] => 312 [2] => 401 [3] => 1599 [4] => 3 )