View Full Version : How to search a string for a specified string?

06-14-2006, 11:27 PM
Hey guys,

How would I search a string for a text like:

$string = "My string goes here, do you see?";
$search = " h";

if php_super_cool_search_function($string,$search) > 0
echo ("found!");
echo ("nothing found, sorry");

What could be the php_super_cool_search_function?


Kid Charming
06-14-2006, 11:41 PM
strpos() (http://us2.php.net/manual/en/function.strpos.php). Be sure to read the specs before using.

06-15-2006, 12:26 PM
Thanks a lot. Have you any good tip how to find functions in PHP manual? If I need something, I really have no idea how do I need to search the PHP manual...

Kid Charming
06-15-2006, 05:00 PM
There's a search box on php.net that lets you search their function list directly; it's in the upper-right corner.