note 51539 added to function.get-browser
| From: | jasperbg at gmail dot com | Date: | Sun, 03 Apr 2005 04:24:01 +0000 |
| Subject: | note 51539 added to function.get-browser | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-87388@lists.php.net to get a copy of this message | ||
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.
----
Manual Page -- http://www.php.net/manual/en/function.get-browser.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+51539
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51539&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51539&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51539&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51539&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51539&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+51539&report=yes
Search -- http://master.php.net/manage/user-notes.php