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.3.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 - 5.6.38, hhvm-3.10.1, 7.0.0 - 7.0.33
Catchable 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 hhvm-3.22.0
Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/prYXX:-1 Stack trace: #0 {main}
Process exited with code 255.
Output for hhvm-3.11.1 - 3.21.3
Fatal error: Uncaught Error: Object of class DateTime could not be converted to string in /in/prYXX:6 Stack trace: #0 {main}
Process exited with code 255.