3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $string1 = 'aaaaaaaaaaaaaaaaaaaa'; $string2 = 'bbbbbbbbbbbbbbbbbbbb'; $string3 = 'cccccccccccccccccccc'; $string4 = 'dddddddddddddddddddd'; $string5 = 'eeeeeeeeeeeeeeeeeeee'; $time1 = microtime(); for ($k = 0; $k<100.00; $k++) { $concatTest1 = $string1 . $string2 . $string3 . $string4 . $string5; } $time2 = microtime(); $testDuration1 = $time2 - $time1; $time3 = microtime(); for ($m = 0; $m<100.00; $m++) { $concatTest2 = "{$string1}{$string2}{$string3}{$string4}{$string5}"; } $time4 = microtime(); $testDuration2 = $time4 - $time3; $time5 = microtime(); for ($p = 0; $p<100.00; $p++) { $concatTest3 = implode('', array($string1, $string2, $string3, $string4, $string5)); } $time6 = microtime(); $testDuration3 = $time6 - $time5; print_r( $testDuration1, $testDuration2, $testDuration3 );
Output for 7.1.0
Notice: A non well formed numeric value encountered in /in/cckYY on line 16 Notice: A non well formed numeric value encountered in /in/cckYY on line 16 Notice: A non well formed numeric value encountered in /in/cckYY on line 24 Notice: A non well formed numeric value encountered in /in/cckYY on line 24 Notice: A non well formed numeric value encountered in /in/cckYY on line 33 Notice: A non well formed numeric value encountered in /in/cckYY on line 33 Warning: print_r() expects at most 2 parameters, 3 given in /in/cckYY on line 36
Output for 7.0.0 - 7.0.14
Warning: print_r() expects at most 2 parameters, 3 given in /in/cckYY on line 36
Output for 4.3.0 - 5.6.21, hhvm-3.10.0 - 3.12.0
Warning: print_r() expects at most 2 parameters, 3 given in /in/cckYY on line 40