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); // returns
> int(1) if true, bool(false) if not
> b) strpos($nav->userAgent, "search for this") > 0 // gives me a boolean
> directly
>
> Any tips of which one I should use?
>
> /Jos� Jeria
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php