- var_dump: documentation ( source)
- time: documentation ( source)
- sprintf: documentation ( source)
<?php
function status(int $now)
{
return sprintf(
'%d is %s',
$now,
match (true) {
$now % 2 == 0 => 'even',
default => 'odd'
}
);
}
$now = time();
var_dump(status($now), status($now + 1));