3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function getTime() { $arg1 = func_get_arg(0); $arg2 = func_get_arg(1); if (is_string($arg1)) { $format = $arg1; } elseif (is_string($arg2)) { $format = $arg2; } else { $format = 'H:i:s'; } if (is_int($arg1)) { $time = $arg1; } elseif (is_int($arg2)) { $time = $arg2; } else { $time = time(); } return date($format, $time); } function testGetTime() { $time = time(); $results = array( date('H:i:s', $time) === getTime($time), date('H:i:s', $time) === getTime(), date('H:i:s', $time) === getTime('H:i:s'), date('H:i', $time) === getTime('H:i', $time), date('H:i', $time) === getTime($time, 'H:i'), ); var_dump($results); } testGetTime();
Output for 4.3.0 - 7.1.0
Warning: func_get_arg(): Argument 1 not passed to function in /in/Q7mOS on line 7 Warning: func_get_arg(): Argument 0 not passed to function in /in/Q7mOS on line 6 Warning: func_get_arg(): Argument 1 not passed to function in /in/Q7mOS on line 7 Warning: func_get_arg(): Argument 1 not passed to function in /in/Q7mOS on line 7 array(5) { [0]=> bool(true) [1]=> bool(true) [2]=> bool(true) [3]=> bool(true) [4]=> bool(true) }