I'm using PHP 7.1.12 and I trying to check if values from an array are present in a string to do that I'm doing this:
public function checkWords($word) {
$list = array('extinção','desativação','obrigatório');
foreach($list as $l) {
if (stripos($word, $l) !== false) {
return true;
}
}
return false;
}
and them I call the function
echo($this->checkWords('Físicaem desativação/extinção voluntária:23000.010237/2012-46''); //returns false
Now comes the weird part, if I go to the function and replace $l with let's say: 'hello'.
public function checkWords($word) {
$list = array('extinção','desativação','obrigatório');
foreach($list as $l) {
if (stripos($word, 'extinção') !== false) {
return true;
}
}
}
the function call will return true
echo($this->checkWords('Físicaem desativação/extinção voluntária:23000.010237/2012-46''); //returns true
Any ideas?