1--TEST-- 2Test wrong number of arguments for microtime() 3--FILE-- 4<?php 5/* 6 * proto mixed microtime([bool get_as_float]) 7 * Function is implemented in ext/standard/microtime.c 8*/ 9 10$opt_arg_0 = true; 11$extra_arg = 1; 12 13echo "\n-- Too many arguments --\n"; 14var_dump(microtime($opt_arg_0, $extra_arg)); 15 16 17echo "\n-- Bad Arg types --\n"; 18 19$bad_args = array(null, 20 1.5, 21 "hello", 22 array('k'=>'v', array(0)), 23 new stdClass, 24 1); 25foreach ($bad_args as $bad_arg) { 26 echo "\n--> bad arg: "; 27 var_dump($bad_arg); 28 var_dump(microtime($bad_arg)); 29} 30 31?> 32===DONE=== 33--EXPECTF-- 34-- Too many arguments -- 35 36Warning: microtime() expects at most 1 parameter, 2 given in %s on line 11 37NULL 38 39-- Bad Arg types -- 40 41--> bad arg: NULL 42string(%d) "%s %s" 43 44--> bad arg: float(1.5) 45float(%s) 46 47--> bad arg: string(5) "hello" 48float(%s) 49 50--> bad arg: array(2) { 51 ["k"]=> 52 string(1) "v" 53 [0]=> 54 array(1) { 55 [0]=> 56 int(0) 57 } 58} 59 60Warning: microtime() expects parameter 1 to be bool, array given in %s on line 25 61NULL 62 63--> bad arg: object(stdClass)#%d (0) { 64} 65 66Warning: microtime() expects parameter 1 to be bool, object given in %s on line 25 67NULL 68 69--> bad arg: int(1) 70float(%s) 71===DONE=== 72