3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $d = 12.23; if(!isset($d) || $d<=0){ echo $d; } $dt = new DateTime(); $dt = $dt->modify('-' . $d . 'days'); echo $dt->getTimeStamp();
based on dUfZC
Output for 5.6.28, 7.0.14 - 7.1.0
1410693633
Output for 7.0.6
1464214111
Output for 7.0.5
1461584586
Output for 7.0.4
1459543075
Output for 7.0.3
1460235696
Output for 7.0.2
1460533520
Output for 7.0.1
1460705047
Output for 7.0.0
1460975527
Output for 5.6.21
1464110069
Output for 5.6.20
1462172358
Output for 5.6.19
1459273891
Output for 5.6.18
1459922373
Output for 5.6.17
1460338685
Output for 5.6.16
1461068113
Output for 5.6.15
1461157988
Output for 5.6.14
1461513426
Output for 5.6.13
1462650846
Output for 5.6.12
1463043396
Output for 5.6.11
1463328962
Output for 5.6.10
1463507628
Output for 5.6.9
1463698608
Output for 5.6.8
1463898738
Output for 5.6.7
1466093174
Output for 5.5.35
1465849589
Output for 5.5.34
1462278700
Output for 5.5.33
1459410286
Output for 5.5.32
1460047702
Output for 5.5.31
1460435550
Output for 5.5.30
1461424783
Output for 5.5.29
1462787660
Output for 5.5.28
1463141147
Output for 5.5.27
1463237197
Output for 5.5.26
1463602075
Output for 5.5.25
1463796860
Output for 5.5.24
1463997321
Output for 5.4.45
1443946515
Output for 5.4.44
1443946512
Output for 5.4.43
1443946509
Output for 5.4.42
1443946507
Output for 5.4.41
1434581514
Output for 5.4.40
1433544225
Output for 5.4.39
1433544224
Output for 5.4.38
1427052162
Output for 5.4.36 - 5.4.37
1424975004
Output for 5.4.35
1417950897
Output for 5.4.34
1417879315
Output for 5.3.29, 5.4.32
1411206805
Output for 5.4.27 - 5.4.31
1410693637
Output for 5.4.5 - 5.4.26
1410693638
Output for 5.3.13 - 5.3.28, 5.4.0 - 5.4.4
1410693639
Output for 5.3.0 - 5.3.12
1410693640
Output for 5.2.0 - 5.2.17
Fatal error: Call to a member function getTimeStamp() on a non-object in /in/DA568 on line 8
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/DA568 on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/DA568 on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/DA568 on line 6