3v4l.org

run code in 300+ PHP versions simultaneously
<?php //echo date( 'd-m-Y', strtotime('2015-03-07')) - date( 'd-m-Y', strtotime("+ 7 days") ); $t1 = new DateTime( '2015-03-07' ); $t2 = new DateTime( "+7 days" ); echo date_diff($t1, $t2)->days;
Output for 5.3.0 - 5.3.29, 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.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
171
Output for 7.0.6
430
Output for 5.6.14, 7.0.5
399
Output for 7.0.4
376
Output for 7.0.3
384
Output for 7.0.2
388
Output for 7.0.1
389
Output for 7.0.0
392
Output for 5.6.21
429
Output for 5.6.20
406
Output for 5.6.19
373
Output for 5.6.18
381
Output for 5.6.17
385
Output for 5.6.16
393
Output for 5.6.15
395
Output for 5.6.13
412
Output for 5.6.12
416
Output for 5.6.11
420
Output for 5.6.10
422
Output for 5.6.9
424
Output for 5.6.8
426
Output for 5.5.35
449
Output for 5.5.34
408
Output for 5.5.33
374
Output for 5.5.32
383
Output for 5.5.31
386
Output for 5.5.30
398
Output for 5.5.29
413
Output for 5.5.28
418
Output for 5.5.27
419
Output for 5.5.26
423
Output for 5.5.25
425
Output for 5.5.24
451
Output for 5.4.39 - 5.4.45
205
Output for 5.4.34 - 5.4.38
14
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined function date_diff() in /in/1fa58 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/1fa58 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/1fa58 on line 5
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
Parse error: parse error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/1fa58 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error, expecting `','' or `';'' in /in/1fa58 on line 5
Process exited with code 255.

preferences:
247.6 ms | 401 KiB | 309 Q