2 Test preg_match() function : error conditions - wrong numbers of parameters
6 * proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
7 * Function is implemented in ext/pcre/php_pcre.c
9 echo "*** Testing preg_match() : error conditions ***\n";
11 echo "\n-- Testing preg_match() function with Zero arguments --\n";
12 var_dump(preg_match());
13 //Test preg_match with one more than the expected number of arguments
14 echo "\n-- Testing preg_match() function with more than expected no. of arguments --\n";
16 $subject = 'string_val';
17 $flags = PREG_OFFSET_CAPTURE;
20 var_dump(preg_match($pattern, $subject, $matches, $flags, $offset, $extra_arg));
21 // Testing preg_match withone less than the expected number of arguments
22 echo "\n-- Testing preg_match() function with less than expected no. of arguments --\n";
24 var_dump(preg_match($pattern));
28 *** Testing preg_match() : error conditions ***
30 -- Testing preg_match() function with Zero arguments --
32 Warning: preg_match() expects at least 2 parameters, 0 given in %spreg_match_error.php on line %d
35 -- Testing preg_match() function with more than expected no. of arguments --
37 Warning: preg_match() expects at most 5 parameters, 6 given in %spreg_match_error.php on line %d
40 -- Testing preg_match() function with less than expected no. of arguments --
42 Warning: preg_match() expects at least 2 parameters, 1 given in %spreg_match_error.php on line %d