3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $begin = (new DateTimeImmutable())->modify('-5 days'); usleep(30); //var_dump($begin->getTimestamp()); $end = new DateTimeImmutable(); //var_dump($begin); //var_dump($end); $diff = $begin->diff($end); //var_dump($diff); var_dump($diff->format('%f'));
Output for 7.3.0beta1
string(3) "120"
Output for 7.3.0alpha1
string(3) "131"
Output for 7.2.6
string(3) "129"
Output for 7.1.20
string(3) "146"
Output for 7.1.8
string(3) "160"
Output for 7.1.7
string(4) "6475"
Output for 7.1.6
string(4) "5143"
Output for 7.1.5
string(3) "155"
Output for 7.1.4
string(3) "137"
Output for 7.1.3
string(1) "0"
Output for 7.1.2
string(2) "96"
Output for 7.1.1
string(3) "148"
Output for 7.1.0
string(3) "161"
Output for 5.5.8 - 5.6.30, 7.0.0 - 7.0.20
string(2) "%f"
Output for hhvm-3.10.1 - 3.21.0
string(1) "%"
Output for 5.5.0 - 5.5.7
Fatal error: DateTime::diff() must be derived from DateTimeImmutable::diff in Unknown on line 0
Process exited with code 255.
Output for 5.4.0 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/RXjmN on line 2
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR in /in/RXjmN on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_OBJECT_OPERATOR in /in/RXjmN on line 2
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/RXjmN on line 2
Process exited with code 255.