3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php for($i=0; $i < 10; $i++) { usleep(rand(0, 100)); $arr[] = microtime(); } //var_dump($arr); echo "------------------------------------------------------------------------------------------------\r"; foreach($arr as $val) { list($msec) = explode(' ', $val); if($prev) { if($msec == $prev) $eq++; elseif($prev + 0.001 == $msec) $plus_one++; else { $not_plus_one++; /* var_dump('not +0.001'); var_dump($prev); var_dump($msec); die(); */ } } $prev = $msec; } var_dump($eq); var_dump($plus_one); var_dump($not_plus_one);
Output for 5.0.4 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
------------------------------------------------------------------------------------------------ Notice: Undefined variable: prev in /in/RaSMC on line 12 Notice: Undefined variable: not_plus_one in /in/RaSMC on line 16 Notice: Undefined variable: eq in /in/RaSMC on line 25 NULL Notice: Undefined variable: plus_one in /in/RaSMC on line 26 NULL int(9)
Output for 4.3.0 - 5.0.3
------------------------------------------------------------------------------------------------ Notice: Undefined variable: prev in /in/RaSMC on line 12 Notice: Undefined variable: not_plus_one in /in/RaSMC on line 16 Notice: Undefined variable: eq in /in/RaSMC on line 25 NULL Notice: Undefined variable: plus_one in /in/RaSMC on line 26 NULL int(9)