3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = '1|27|31|33'; $separator = '##|##'; $iterations = 100000; $time = microtime(true); for ($i = 0; $i < $iterations; $i++) { $result = str_replace('|', $separator, $input); } $time1 = microtime(true); echo 'processed in ' . (($time1 - $time) * 1000) . ' millisecs'; for ($i = 0; $i < $iterations; $i++) { $result = ''; $it = new CachingIterator(new ArrayIterator(explode('|', $input)), CachingIterator::FULL_CACHE); foreach ($it as $categoryId) { $result .= $categoryId; if ($it->hasNext()) { $result .= $separator; } } } $time2 = microtime(true); echo 'processed in ' . (($time2 - $time1) * 1000) . ' millisecs';
Output for 5.4.45
processed in 28.517007827759 millisecsprocessed in 356.08911514282 millisecs
Output for 5.4.44
processed in 23.072957992554 millisecsprocessed in 311.09309196472 millisecs
Output for 5.4.43
processed in 32.718181610107 millisecsprocessed in 319.83995437622 millisecs
Output for 5.4.42
processed in 31.4040184021 millisecsprocessed in 315.62900543213 millisecs
Output for 5.4.41
processed in 38.980960845947 millisecsprocessed in 319.77105140686 millisecs
Output for 5.4.40
processed in 30.860900878906 millisecsprocessed in 311.79404258728 millisecs
Output for 5.4.39
processed in 25.830984115601 millisecsprocessed in 360.97884178162 millisecs
Output for 5.4.38
processed in 39.768934249878 millisecsprocessed in 352.18906402588 millisecs
Output for 5.4.37
processed in 23.311853408813 millisecsprocessed in 314.66007232666 millisecs
Output for 5.4.36
processed in 31.651020050049 millisecsprocessed in 370.33295631409 millisecs
Output for 5.4.35
processed in 42.082071304321 millisecsprocessed in 371.05011940002 millisecs
Output for 5.4.34
processed in 23.826122283936 millisecsprocessed in 308.72392654419 millisecs
Output for 5.4.32
processed in 22.844076156616 millisecsprocessed in 304.2299747467 millisecs
Output for 5.4.31
processed in 23.229122161865 millisecsprocessed in 313.36688995361 millisecs
Output for 5.4.30
processed in 26.096105575562 millisecsprocessed in 358.726978302 millisecs
Output for 5.4.29
processed in 22.985935211182 millisecsprocessed in 301.21994018555 millisecs
Output for 5.4.28
processed in 36.617994308472 millisecsprocessed in 310.42098999023 millisecs
Output for 5.4.27
processed in 32.251119613647 millisecsprocessed in 368.49188804626 millisecs
Output for 5.4.26
processed in 35.13503074646 millisecsprocessed in 326.43795013428 millisecs
Output for 5.4.25
processed in 36.366939544678 millisecsprocessed in 372.24006652832 millisecs
Output for 5.4.24
processed in 27.740001678467 millisecsprocessed in 361.37413978577 millisecs
Output for 5.4.23
processed in 32.121896743774 millisecsprocessed in 320.94311714172 millisecs
Output for 5.4.22
processed in 35.331010818481 millisecsprocessed in 329.53596115112 millisecs
Output for 5.4.21
processed in 26.270151138306 millisecsprocessed in 419.273853302 millisecs
Output for 5.4.20
processed in 35.67099571228 millisecsprocessed in 323.38285446167 millisecs
Output for 5.4.19
processed in 22.922992706299 millisecsprocessed in 311.15508079529 millisecs
Output for 5.4.18
processed in 35.58611869812 millisecsprocessed in 326.05290412903 millisecs
Output for 5.4.17
processed in 34.250020980835 millisecsprocessed in 325.95801353455 millisecs
Output for 5.4.16
processed in 28.57494354248 millisecsprocessed in 315.41299819946 millisecs
Output for 5.4.15
processed in 33.227920532227 millisecsprocessed in 320.21498680115 millisecs
Output for 5.4.14
processed in 24.511098861694 millisecsprocessed in 313.52806091309 millisecs
Output for 5.4.13
processed in 30.52806854248 millisecsprocessed in 316.54715538025 millisecs
Output for 5.4.12
processed in 30.761003494263 millisecsprocessed in 415.93599319458 millisecs
Output for 5.4.11
processed in 36.738157272339 millisecsprocessed in 323.69589805603 millisecs
Output for 5.4.10
processed in 26.280879974365 millisecsprocessed in 346.29106521606 millisecs
Output for 5.4.9
processed in 40.302038192749 millisecsprocessed in 341.06993675232 millisecs
Output for 5.4.8
processed in 22.6891040802 millisecsprocessed in 300.15206336975 millisecs
Output for 5.4.7
processed in 26.982069015503 millisecsprocessed in 360.59284210205 millisecs
Output for 5.4.6
processed in 34.306049346924 millisecsprocessed in 311.71011924744 millisecs
Output for 5.4.5
processed in 37.069082260132 millisecsprocessed in 337.45789527893 millisecs
Output for 5.4.4
processed in 33.107995986938 millisecsprocessed in 317.1079158783 millisecs
Output for 5.4.3
processed in 33.735036849976 millisecsprocessed in 324.27287101746 millisecs
Output for 5.4.2
processed in 22.725820541382 millisecsprocessed in 300.94003677368 millisecs
Output for 5.4.1
processed in 39.141178131104 millisecsprocessed in 331.62093162537 millisecs
Output for 5.4.0
processed in 26.264905929565 millisecsprocessed in 314.49508666992 millisecs
Output for 5.3.29
processed in 29.531002044678 millisecsprocessed in 361.38010025024 millisecs
Output for 5.3.28
processed in 43.633937835693 millisecsprocessed in 368.29519271851 millisecs
Output for 5.3.27
processed in 30.040979385376 millisecsprocessed in 360.2340221405 millisecs
Output for 5.3.26
processed in 41.810035705566 millisecsprocessed in 371.51384353638 millisecs
Output for 5.3.25
processed in 42.080163955688 millisecsprocessed in 366.90783500671 millisecs
Output for 5.3.24
processed in 38.203001022339 millisecsprocessed in 359.77506637573 millisecs
Output for 5.3.23
processed in 38.439989089966 millisecsprocessed in 359.38096046448 millisecs
Output for 5.3.22
processed in 42.041063308716 millisecsprocessed in 372.18809127808 millisecs
Output for 5.3.21
processed in 29.051065444946 millisecsprocessed in 341.25399589539 millisecs
Output for 5.3.20
processed in 43.862819671631 millisecsprocessed in 369.29607391357 millisecs
Output for 5.3.19
processed in 30.118942260742 millisecsprocessed in 358.29997062683 millisecs
Output for 5.3.18
processed in 41.224956512451 millisecsprocessed in 362.57195472717 millisecs
Output for 5.3.17
processed in 45.129060745239 millisecsprocessed in 448.82202148438 millisecs
Output for 5.3.16
processed in 43.889045715332 millisecsprocessed in 372.49088287354 millisecs
Output for 5.3.15
processed in 44.573068618774 millisecsprocessed in 432.71589279175 millisecs
Output for 5.3.14
processed in 38.194894790649 millisecsprocessed in 365.44418334961 millisecs
Output for 5.3.13
processed in 29.709100723267 millisecsprocessed in 357.9728603363 millisecs
Output for 5.3.12
processed in 43.844938278198 millisecsprocessed in 355.16786575317 millisecs
Output for 5.3.11
processed in 38.228034973145 millisecsprocessed in 398.44799041748 millisecs
Output for 5.3.10
processed in 44.52109336853 millisecsprocessed in 370.51391601562 millisecs
Output for 5.3.9
processed in 43.696165084839 millisecsprocessed in 363.94786834717 millisecs
Output for 5.3.8
processed in 30.550956726074 millisecsprocessed in 355.1709651947 millisecs
Output for 5.3.7
processed in 30.066013336182 millisecsprocessed in 384.91702079773 millisecs
Output for 5.3.6
processed in 40.102005004883 millisecsprocessed in 371.25492095947 millisecs
Output for 5.3.5
processed in 42.726993560791 millisecsprocessed in 456.03704452515 millisecs
Output for 5.3.4
processed in 31.275033950806 millisecsprocessed in 356.90498352051 millisecs
Output for 5.3.3
processed in 40.667057037354 millisecsprocessed in 343.59383583069 millisecs
Output for 5.3.2
processed in 37.974834442139 millisecsprocessed in 361.04607582092 millisecs
Output for 5.3.1
processed in 35.373210906982 millisecsprocessed in 437.54982948303 millisecs
Output for 5.3.0
processed in 41.218042373657 millisecsprocessed in 381.64305686951 millisecs