/ / the "i" after the pattern delimiter indicates a case-insensitive search if (preg_match (" / php / i", "PHP is the web scripting language of choice .")) {print "A match was found .";} else {print "A match was not found .";}
preg_match() returns the number of times pattern matches. That will be either 0 times (no match) or 1 time because preg_match() will stop searching after the first match. preg_match_all() on the contrary will continue until it reaches the end of subject. preg_match() returns FALSE if an error occured.