3v4l.org

run code in 300+ PHP versions simultaneously
<?php $offset = 5; $offsetStr = "PT".$offset."H"; $date = new DateTime("18-July-2008 16:30:30"); $date->sub($date, new DateInterval($offsetStr)); echo $date->format("d-m-Y H:i:s").' : 2 Hours'; echo $date->format("d-m-Y H:i:s").'<br />'; echo '<br />'.$date->format("d-m-Y").' : 5 Days'; date_sub($date, new DateInterval("P5Y5M5D")); echo '<br />'.$date->format("d-m-Y").' : 5 Days, 5 Months, 5 Years'; date_sub($date, new DateInterval("P5YT5H")); echo '<br />'.$date->format("d-m-Y H:i:s").' : 5 Years, 5 Hours'; ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: DateTime::sub() expects exactly 1 argument, 2 given in /in/hk1rE:7 Stack trace: #0 /in/hk1rE(7): DateTime->sub(Object(DateTime), Object(DateInterval)) #1 {main} thrown in /in/hk1rE on line 7
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
44.25 ms | 401 KiB | 8 Q