My script looks for a status keyword in a line received from a serial gateway: if (strpos($line, 'ERR')) { ... }. It detects ERR in the middle of a line but not when the line begins with it, which is the case I care about. A related check, if ($code == 'abc'), used to be true when $code was the integer 0.
What is going on with these comparisons, and what is the correct way to test whether a string contains or starts with another string?




