Re: stripos kills my script but strpos is fine?
| From: | Michael | Date: | Wed, 02 Feb 2005 19:29:43 +0000 |
| Subject: | Re: stripos kills my script but strpos is fine? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-207924@lists.php.net to get a copy of this message | ||
Richard Lynch wrote:
Michael wrote:<snip problem description>I'm trying to use stripos as a faster and less resource-intensive alternative to preg_match with the i flag, but I'm getting some strange behavior.
Aha. Must have missed that in the docs.AFAIK, stripos should behave exactly like strpos except case-insensitively. So in the function above, it should make absolutely no difference which one I use.stripos only exists in PHP 5.
You are probably running PHP 4.Yes, indeed I am. That would be the problem then.
You also are hiding/re-directing your error messages somewhere, and have not gotten into the habit (yet) of reading the error log.On this point, however, you're mistaken (not your fault, of course... :) ). I was watching tail -f php_error_log as I was diagnosing the problem. I've written a custom error handler, however, which may not be handling PHP-generated errors correctly (although it does deal with syntax errors, for instance). So I'm not sure what the issue is there. But that's less important. Thanks very much for your help! Mike