3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Europe/Amsterdam'); function logs($type, $action, $executionTime = null) { return [ [ 'time' => (new \DateTime)->format('d-m-Y H:i:s'), 'type' => $type, 'action' => $action, 'executionTime' => $executionTime, ]]; } $foo = logs('someType', 'someAction'); //var_dump($foo); var_dump(preg_match('/^(0[1-9]|[12][\d]|3[12])-(0[1-9]|1[0-2])-[\d]{4} (0[1-9]|1[\d]|2[0-3]):(0[1-9]|[1-5][\d]):(0[1-9]|[1-5][\d])$/', $foo[0]['time']));
Output for 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
int(1)
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/mK1PG on line 7
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/mK1PG on line 7
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/mK1PG on line 7
Process exited with code 255.