note 51539 deleted from function.get-browser by bjori
| From: | bjori@php.net | Date: | Mon, 09 Oct 2006 11:00:21 +0000 |
| Subject: | note 51539 deleted from function.get-browser by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-118257@lists.php.net to get a copy of this message | ||
Note Submitter: jasperbg at gmail dot com
----
To :: TomkOx ::
It's actually better to use strpos(). You need to use === or !== rather than == or != to check
the return value though, otherwise you'll get 0 which equates to false when the string is found
at position 0.
For example:
<?php
if(strpos($haystack, $needle) !== false) {
/* String was found */
} else {
/* String wasn't found */
}
?>
That'll work for any position, even 0.