I have an array that looks like this:
Array ([0] => Vice President [1] => [2] => other [3] => Treasurer)
and I want to remove the value of c otherin the value.
I am trying to use array_filterto filter this word, but array_filterwill also delete all empty values.
I want the result to be like this:
Array ([0] => Vice President [1] => [2] => Treasurer)
This is my PHP filter code:
function filter($element) {
$bad_words = array('other');
list($name, $extension) = explode(".", $element);
if(in_array($name, $bad_words))
return;
return $element;
}
$sport_level_new_arr = array_filter($sport_level_name_arr, "filter");
$sport_level_new_arr = array_values($sport_level_new_arr);
$sport_level_name = serialize($sport_level_new_arr);
Can I use another method to filter this word?
wyman source
share