3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $datang = new DateTime('20-08-2010 00:02:12'); $pulang = new DateTime('2-11-2014 17:08:35'); $selisih = $datang->diff($pulang); echo $selisih->format("%Y tahun, %m bulan, %d hari, %h jam, %i menit, %s detik"), PHP_EOL; echo $selisih->format("%h jam");
Output for 5.3.0 - 5.6.28, hhvm-3.12.0, 7.0.0 - 7.1.0
04 tahun, 2 bulan, 13 hari, 17 jam, 6 menit, 23 detik 17 jam
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/NTQBQ on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/NTQBQ on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/NTQBQ on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/NTQBQ on line 3