1--TEST-- 2Test preg_split() function : error conditions - wrong arg types 3--FILE-- 4<?php 5/* 6* proto array preg_split(string pattern, string subject [, int limit [, int flags]]) 7* Function is implemented in ext/pcre/php_pcre.c 8*/ 9error_reporting(E_ALL&~E_NOTICE); 10/* 11* Testing how preg_split reacts to being passed the wrong type of input argument 12*/ 13echo "*** Testing preg_split() : error conditions ***\n"; 14$regex = '/[a-zA-Z]/'; 15$input = array(array('this is', 'a subarray'),); 16foreach($input as $value) { 17 print "\nArg value is: $value\n"; 18 var_dump(preg_split($regex, $value)); 19} 20$value = new stdclass(); //Object 21var_dump(preg_split($regex, $value)); 22echo "Done"; 23?> 24--EXPECTF-- 25*** Testing preg_split() : error conditions *** 26 27Arg value is: Array 28 29Warning: preg_split() expects parameter 2 to be string, array given in %spreg_split_error2.php on line %d 30bool(false) 31 32Warning: preg_split() expects parameter 2 to be string, object given in %spreg_split_error2.php on line %d 33bool(false) 34Done