3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new \Datetime("2015-12-03"); $b = new \Datetime("2015-12-12"); print_r($b->diff($a)->format("%y - %m - %d")). "\n"; $now = new DateTime; $clone = clone $now; $clone->modify( '-1 day' ); echo $now->format( 'd-m-Y' ), "\n", $clone->format( 'd-m-Y' );
based on Fb0lW
Output for 5.3.20 - 5.4.45, 5.6.28, 7.0.20 - 7.2.0
0 - 0 - 908-12-2015 07-12-2015
Output for 7.0.6
0 - 0 - 903-05-2016 02-05-2016
Output for 7.0.5
0 - 0 - 903-04-2016 02-04-2016
Output for 7.0.4
0 - 0 - 910-03-2016 09-03-2016
Output for 7.0.3
0 - 0 - 918-03-2016 17-03-2016
Output for 7.0.2
0 - 0 - 923-03-2016 22-03-2016
Output for 7.0.1
0 - 0 - 924-03-2016 23-03-2016
Output for 7.0.0
0 - 0 - 927-03-2016 26-03-2016
Output for 5.6.21
0 - 0 - 902-05-2016 01-05-2016
Output for 5.6.20
0 - 0 - 910-04-2016 09-04-2016
Output for 5.6.19
0 - 0 - 908-03-2016 07-03-2016
Output for 5.6.18
0 - 0 - 915-03-2016 14-03-2016
Output for 5.6.17
0 - 0 - 920-03-2016 19-03-2016
Output for 5.6.16
0 - 0 - 928-03-2016 27-03-2016
Output for 5.6.15
0 - 0 - 929-03-2016 28-03-2016
Output for 5.6.14
0 - 0 - 914-04-2016 13-04-2016
Output for 5.6.13
0 - 0 - 915-04-2016 14-04-2016
Output for 5.6.12
0 - 0 - 920-04-2016 19-04-2016
Output for 5.6.11
0 - 0 - 924-04-2016 23-04-2016
Output for 5.6.10
0 - 0 - 925-04-2016 24-04-2016
Output for 5.6.9
0 - 0 - 927-04-2016 26-04-2016
Output for 5.6.8
0 - 0 - 930-04-2016 29-04-2016
Output for 5.5.35
0 - 0 - 923-05-2016 22-05-2016
Output for 5.5.34
0 - 0 - 911-04-2016 10-04-2016
Output for 5.5.33
0 - 0 - 909-03-2016 08-03-2016
Output for 5.5.32
0 - 0 - 917-03-2016 16-03-2016
Output for 5.5.31
0 - 0 - 921-03-2016 20-03-2016
Output for 5.5.30
0 - 0 - 901-04-2016 31-03-2016
Output for 5.5.29
0 - 0 - 917-04-2016 16-04-2016
Output for 5.5.28
0 - 0 - 921-04-2016 20-04-2016
Output for 5.5.27
0 - 0 - 922-04-2016 21-04-2016
Output for 5.5.26
0 - 0 - 926-04-2016 25-04-2016
Output for 5.5.25
0 - 0 - 929-04-2016 28-04-2016
Output for 5.5.24
0 - 0 - 924-05-2016 23-05-2016