remove a specific element from array inside a loop php

68

if (($key = array_search('strawberry', $array)) !== false) {
    unset($array[$key]);
}
if (($key = array_search('strawberry', $array)) !== false) {
    unset($array[$key]);
}

Comments

Submit
0 Comments