3v4l.org

run code in 300+ PHP versions simultaneously
<?php $expiration = new \DateTime('2015-02-17'); $expiration->add(\DateInterval::createFromDateString('1 day')); echo $expiration->diff(new \DateTime())->format('%a');
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.37, 5.6.28, 7.0.14 - 7.0.20, 7.1.0 - 7.1.20, 7.2.5 - 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
1
Output for 7.0.6
458
Output for 5.6.14, 7.0.5
421
Output for 7.0.4
386
Output for 7.0.3
394
Output for 7.0.2
398
Output for 7.0.1
400
Output for 7.0.0
403
Output for 5.6.21
439
Output for 5.6.20
417
Output for 5.6.19
383
Output for 5.6.18
391
Output for 5.6.17
395
Output for 5.6.16
404
Output for 5.6.15
405
Output for 5.6.13
422
Output for 5.6.12
427
Output for 5.6.11
431
Output for 5.6.10
432
Output for 5.6.9
435
Output for 5.6.8
437
Output for 5.5.35
460
Output for 5.5.34
418
Output for 5.5.33
385
Output for 5.5.32
393
Output for 5.5.31
396
Output for 5.5.30
408
Output for 5.5.29
424
Output for 5.5.28
428
Output for 5.5.27
429
Output for 5.5.26
433
Output for 5.5.25
436
Output for 5.5.24
461
Output for 5.4.45
211
Output for 5.4.44
191
Output for 5.4.38 - 5.4.43
143
Output for 5.2.0 - 5.2.17
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 6 Fatal error: Call to undefined method DateTime::add() in /in/Tc4Tm on line 4
Process exited with code 255.
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/Tc4Tm on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 6 Fatal error: Class 'DateTime' not found in /in/Tc4Tm on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 6 Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Tc4Tm 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/Tc4Tm on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 6 Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Tc4Tm 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/Tc4Tm on line 3 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 4 Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /in/Tc4Tm on line 6 Parse error: parse error, expecting `','' or `';'' in /in/Tc4Tm on line 6
Process exited with code 255.

preferences:
249.95 ms | 402 KiB | 311 Q