Re: Best way to check for some certain text in a string
| From: | Bogdan Stancescu | Date: | Wed, 21 Aug 2002 13:54:58 +0000 |
| Subject: | Re: Best way to check for some certain text in a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-113459@lists.php.net to get a copy of this message | ||
If you don't need regexps, use strpos. Make sure you read the documentation though - if $nav->userAgent starts with "search for this", your code will return false.
Bogdan
José Jeria wrote:
I want to find a certain text in a string and i want it to return me a boolean. What is the best thing to do this?a) ereg("search for this", $string); // returnsint(1) if true, bool(false) if notb) strpos($nav->userAgent, "search for this") > 0 // gives me a booleandirectly Any tips of which one I should use? /José Jeria