3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month=(new \DateTime())->format('m'); $day=(new \DateTime())->format('d'); $year=(new \DateTime())->format('y'); if ($year % 2 == 0) { $yr=1; } else { $yr=2; } echo ($month.$day.$yr); ?>
Output for 5.4.0 - 5.4.32, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
10161
Output for 7.0.6
05031
Output for 7.0.5
04021
Output for 7.0.4
03101
Output for 7.0.3
03181
Output for 7.0.2
03211
Output for 7.0.1
03231
Output for 7.0.0
03261
Output for 5.6.21
05011
Output for 5.6.20
04091
Output for 5.6.19
03061
Output for 5.6.18
03141
Output for 5.6.17
03191
Output for 5.6.16
03271
Output for 5.6.15
03281
Output for 5.6.14
04011
Output for 5.6.13
04141
Output for 5.6.12
04191
Output for 5.6.11
04221
Output for 5.6.10
04241
Output for 5.6.9
04271
Output for 5.6.8
04291
Output for 5.6.7
05241
Output for 5.5.35
05221
Output for 5.5.34
04101
Output for 5.5.33
03081
Output for 5.5.32
03161
Output for 5.5.31
03201
Output for 5.5.30
03311
Output for 5.5.29
04161
Output for 5.5.28
04201
Output for 5.5.27
04211
Output for 5.5.26
04251
Output for 5.5.25
04281
Output for 5.5.24
04301
Output for 5.4.45
09212
Output for 5.4.43 - 5.4.44
08122
Output for 5.4.34 - 5.4.42
07092
Output for 5.3.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/N2fV1 on line 1
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/N2fV1 on line 1 Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/N2fV1 on line 1
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/N2fV1 on line 1 Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/N2fV1 on line 1
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/N2fV1 on line 1 Parse error: parse error in /in/N2fV1 on line 1
Process exited with code 255.

preferences:
200.21 ms | 401 KiB | 313 Q