1if (preg_match("/\bweb\b/i", "PHP is the web scripting language of choice.")) {
2 echo "A match was found.";
3} else {
4 echo "A match was not found.";
5}
1preg_match ( string $pattern , string $subject [, array &$matches [, int $flags = 0 [, int $offset = 0 ]]] ) : int
1
2<?php
3// The "i" after the pattern delimiter indicates a case-insensitive search
4if (preg_match("/php/i", "PHP is the web scripting language of choice.")) {
5 echo "A match was found.";
6} else {
7 echo "A match was not found.";
8}
9?>
10
11