3v4l.org

run code in 300+ PHP versions simultaneously
<?php $now = new \DateTime('now'); $a = \DateTime::createFromFormat(); echo $now->diff(new \DateTime('1981-02-10'))->y;
Output for 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Fatal error: Uncaught ArgumentCountError: DateTime::createFromFormat() expects at least 2 arguments, 0 given in /in/Oo66O:5 Stack trace: #0 /in/Oo66O(5): DateTime::createFromFormat() #1 {main} thrown in /in/Oo66O on line 5
Process exited with code 255.
Output for 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33
Warning: DateTime::createFromFormat() expects at least 2 parameters, 0 given in /in/Oo66O on line 5 33
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 6 Fatal error: Class 'DateTime' not found in /in/Oo66O on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 6 Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Oo66O on line 6
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
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 6 Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Oo66O on line 6
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 5 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Oo66O on line 6 Parse error: parse error, expecting `','' or `';'' in /in/Oo66O on line 6
Process exited with code 255.

preferences:
153.38 ms | 402 KiB | 188 Q