preg_match() accepts four arguments:
a regular expression string,
a source string,
an array variable (which stores matches),
and an optional fourth flag argument.
preg_match() returns 0 if a match is found and 1 otherwise.
These numbers represent the number of matches the function can make in a string.
<?
print "<pre>\n";
print preg_match("/is/", "this is a test", $array) . "\n";
print_r( $array );
print "</pre>\n";
?>
|