3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $datetime1 = DateTime::createFromFormat('Ymd', '20150104')->format('Y-m-d'); $datetime2 = DateTime::createFromFormat('Ymd', '20160104')->format('Y-m-d'); echo "<pre>"; echo $datetime1->diff($datetime2)->format('%R%y');
based on KQj7P
Output for 7.0.0 - 7.2.0
<pre> Fatal error: Uncaught Error: Call to a member function diff() on string in /in/iOPiM:7 Stack trace: #0 {main} thrown in /in/iOPiM on line 7
Process exited with code 255.
Output for 5.6.8 - 5.6.28
<pre> Fatal error: Call to a member function diff() on string in /in/iOPiM on line 7
Process exited with code 255.
Output for 5.3.20 - 5.5.35
<pre> Fatal error: Call to a member function diff() on a non-object in /in/iOPiM on line 7
Process exited with code 255.