- var_dump: documentation ( source)
- preg_match: documentation ( source)
- date_default_timezone_set: documentation ( source)
<?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']));