3 * proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
4 * Function is implemented in ext/pcre/php_pcre.c
6 echo "***Testing preg_replace_callback() : error conditions***\n";
8 echo "\n-- Testing preg_replace_callback() function with Zero arguments --\n";
9 var_dump(preg_replace_callback());
10 //Test preg_replace_callback() with one more than the expected number of arguments
11 echo "\n-- Testing preg_replace_callback() function with more than expected no. of arguments --\n";
12 $replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
13 function integer_word($matches) {
15 return $replacement[$matches[0]];
18 $subject = 'there are 7 words in this sentence.';
21 var_dump(preg_replace_callback($regex, 'integer_word', $subject, $limit, $count, $extra_arg));
22 //Testing preg_replace_callback() with one less than the expected number of arguments
23 echo "\n-- Testing preg_replace_callback() function with less than expected no. of arguments --\n";
25 var_dump(preg_replace_callback($regex, 'integer word'));