3v4l.org

run code in 300+ PHP versions simultaneously
<?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));
Output for 8.0.1 - 8.0.21, 8.1.0 - 8.1.8
string(17) "1658126363 is odd" string(18) "1658126364 is even"
Output for 7.4.0 - 7.4.30
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW) in /in/2s8uK on line 9
Process exited with code 255.

preferences:
58.14 ms | 407 KiB | 5 Q