Best way to check for some certain text in a string

From: Date: Wed, 21 Aug 2002 13:22:36 +0000
Subject: Best way to check for some certain text in a string
Groups: php.general 
Request: Send a blank email to php-general+get-113444@lists.php.net to get a copy of this message
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

« previous php.general (#113444) next »