1--TEST-- 2Test ereg() function : error conditions - wrong number of args 3--FILE-- 4<?php 5/* Prototype : proto int ereg(string pattern, string string [, array registers]) 6 * Description: Regular expression match 7 * Source code: ext/standard/reg.c 8 * Alias to functions: 9 */ 10 11/* 12 * Test wrong number of args 13 */ 14 15echo "*** Testing ereg() : error conditions ***\n"; 16 17 18//Test ereg with one more than the expected number of arguments 19echo "\n-- Testing ereg() function with more than expected no. of arguments --\n"; 20$pattern = 'string_val'; 21$string = 'string_val'; 22$registers = array(1, 2); 23$extra_arg = 10; 24var_dump( ereg($pattern, $string, $registers, $extra_arg) ); 25 26// Testing ereg with one less than the expected number of arguments 27echo "\n-- Testing ereg() function with less than expected no. of arguments --\n"; 28$pattern = 'string_val'; 29var_dump( ereg($pattern) ); 30 31echo "Done"; 32?> 33--EXPECTF-- 34*** Testing ereg() : error conditions *** 35 36-- Testing ereg() function with more than expected no. of arguments -- 37 38Deprecated: Function ereg() is deprecated in %s on line %d 39 40Warning: ereg() expects at most 3 parameters, 4 given in %s on line %d 41NULL 42 43-- Testing ereg() function with less than expected no. of arguments -- 44 45Deprecated: Function ereg() is deprecated in %s on line %d 46 47Warning: ereg() expects at least 2 parameters, 1 given in %s on line %d 48NULL 49Done 50