1--TEST-- 2Test wrong number of arguments for microtime() 3--FILE-- 4<?php 5/* 6 * Function is implemented in ext/standard/microtime.c 7*/ 8 9echo "\n-- Bad Arg types --\n"; 10 11$bad_args = array(null, 12 1.5, 13 "hello", 14 array('k'=>'v', array(0)), 15 new stdClass, 16 1); 17foreach ($bad_args as $bad_arg) { 18 echo "\n--> bad arg: "; 19 var_dump($bad_arg); 20 try { 21 var_dump(microtime($bad_arg)); 22 } catch (TypeError $e) { 23 echo $e->getMessage(), "\n"; 24 } 25} 26 27?> 28--EXPECTF-- 29-- Bad Arg types -- 30 31--> bad arg: NULL 32string(%d) "%s %s" 33 34--> bad arg: float(1.5) 35float(%s) 36 37--> bad arg: string(5) "hello" 38float(%s) 39 40--> bad arg: array(2) { 41 ["k"]=> 42 string(1) "v" 43 [0]=> 44 array(1) { 45 [0]=> 46 int(0) 47 } 48} 49microtime(): Argument #1 ($as_float) must be of type bool, array given 50 51--> bad arg: object(stdClass)#%d (0) { 52} 53microtime(): Argument #1 ($as_float) must be of type bool, stdClass given 54 55--> bad arg: int(1) 56float(%s) 57