If you read the documentation for stripos() , you will find.
Returns the position of the needle relative to the beginning of the haystack line (regardless of offset). Also note that line positions start at 0, not 1.
Returns FALSE if the needle is not found.
It does not return TRUE . Since you are using strict equality , your condition will never be true.
If you did stripos($val, 'NULL') == TRUE , then your code would execute if NULL was found at position 0 - since PHP would do type manipulation and effectively 0 == (int)true .
The appropriate way to check for existence with stripos() is what you have:
if (stripos($val, 'NULL') !== FALSE){ echo "IS $val"; }
source share