3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $amount = 100000; $size = 15; $data = []; for ($i = 0; $i < $size; ++$i) { $data[$i] = rand(0, 1) ? bin2hex(random_bytes(3)) : null; } $start = microtime(true); for ($lap = 0; $lap < $amount; ++$lap) { $dataFiltered = []; for ($i = 0; $i < $size; ++$i) { if (!is_null($data[$i])) { $dataFiltered[$i] = $data[$i]; } } } $time = microtime(true) - $start; echo "Manual: $time\n"; $start = microtime(true); for ($lap = 0; $lap < $amount; ++$lap) { $dataFiltered = array_filter($data, function($value) { return !is_null($value); }); } $time = microtime(true) - $start; echo "Auto: $time\n";
based on uWsHO
Output for 7.2.0
Manual: 0.063614130020142 Auto: 0.10473895072937
Output for 7.1.7
Manual: 0.061316013336182 Auto: 0.10146594047546
Output for 7.1.6
Manual: 0.049751043319702 Auto: 0.10782694816589
Output for 7.1.5
Manual: 0.093317031860352 Auto: 0.1092631816864
Output for 7.1.1
Manual: 0.075323104858398 Auto: 0.14472103118896
Output for 7.1.0
Manual: 0.090314149856567 Auto: 0.14759397506714
Output for 7.0.20
Manual: 0.061272859573364 Auto: 0.092803001403809
Output for 7.0.15
Manual: 0.098498106002808 Auto: 0.22025394439697
Output for 7.0.14
Manual: 0.094511985778809 Auto: 0.14716100692749
Output for 7.0.13
Manual: 0.1091001033783 Auto: 0.14969301223755
Output for 7.0.12
Manual: 0.099622011184692 Auto: 0.14532804489136
Output for 7.0.11
Manual: 0.09608793258667 Auto: 0.17154598236084
Output for 7.0.10
Manual: 0.086950063705444 Auto: 0.13746809959412
Output for 7.0.9
Manual: 0.13629198074341 Auto: 0.14697980880737
Output for 7.0.8
Manual: 0.13033080101013 Auto: 0.15378880500793
Output for 7.0.7
Manual: 0.11388802528381 Auto: 0.14916682243347
Output for 7.0.6
Manual: 0.11034512519836 Auto: 0.191810131073
Output for 7.0.5
Manual: 0.091356039047241 Auto: 0.18963003158569
Output for 7.0.4
Manual: 0.096328973770142 Auto: 0.19278383255005
Output for 7.0.3
Manual: 0.1091001033783 Auto: 0.19093894958496
Output for 7.0.2
Manual: 0.1289439201355 Auto: 0.21533894538879
Output for 7.0.1
Manual: 0.13109707832336 Auto: 0.22355580329895
Output for 7.0.0
Manual: 0.09424614906311 Auto: 0.19040703773499
Output for hhvm-3.15.4
Manual: 0.28326201438904 Auto: 0.40935301780701
Output for 5.6.0 - 5.6.30
Fatal error: Call to undefined function random_bytes() in /in/cgvdk on line 8
Process exited with code 255.