3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $then = '2005-09-01 09:02:23'; $then = new DateTime($then); $now = new DateTime(); echo $now; $sinceThen = $then->diff($now); //Combined echo $sinceThen->y.' years have passed.<br>'; echo $sinceThen->m.' months have passed.<br>'; echo $sinceThen->d.' days have passed.<br>'; echo $sinceThen->h.' hours have passed.<br>'; echo $sinceThen->i.' minutes have passed.<br>';
based on Ikbdk
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class DateTime could not be converted to string in /in/prYXX on line 6
Process exited with code 255.
Output for 5.3.19 - 7.0.20
Catchable fatal error: Object of class DateTime could not be converted to string in /in/prYXX on line 6
Process exited with code 255.