3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $starttime = microtime(true); $sArr = array(); for ($i = 0; $i < 300000; $i++) { $sArr[] = 'String concatenation. ' . $i; } $str = implode('', $sArr); $x = md5($str); $endtime = microtime(true); print "array append & implode: " . ($endtime - $starttime) . " s\n" ; // standard string append $starttime = microtime(true); $str = ''; for ($i = 0; $i < 300000; $i++) { $str .= 'String concatenation. ' . $i; } $x = md5($str); unset($str); $endtime = microtime(true); print "string concat: " . ($endtime - $starttime) . " s\n" ; $starttime = microtime(true); $sArr = array(); for ($i = 0; $i < 300000; $i++) { $sArr[] = 'String concatenation. ' . $i; } $str = implode('', $sArr); $x = md5($str); $endtime = microtime(true); print "array append & implode: " . ($endtime - $starttime) . " s\n" ;
Output for 7.1.0
array append & implode: 0.063390970230103 s string concat: 0.052050828933716 s array append & implode: 0.047937870025635 s
Output for 7.0.14
array append & implode: 0.061092138290405 s string concat: 0.043226957321167 s array append & implode: -0.047291994094849 s
Output for 7.0.10
array append & implode: 0.16210103034973 s string concat: 0.05564284324646 s array append & implode: 0.056777000427246 s
Output for 7.0.9
array append & implode: 0.085577964782715 s string concat: 0.04931902885437 s array append & implode: 0.05614185333252 s
Output for 7.0.8
array append & implode: 0.11624193191528 s string concat: 0.05500602722168 s array append & implode: 0.056189775466919 s
Output for 7.0.7
array append & implode: 0.079866170883179 s string concat: 0.045683145523071 s array append & implode: 0.055502891540527 s
Output for 7.0.6
array append & implode: 0.079388856887817 s string concat: 0.046530961990356 s array append & implode: 0.054378986358643 s
Output for 7.0.5
array append & implode: 0.082194089889526 s string concat: 0.056043863296509 s array append & implode: 0.056039094924927 s
Output for 7.0.4
array append & implode: 0.094598054885864 s string concat: 0.055662155151367 s array append & implode: 0.062594890594482 s
Output for 7.0.3
array append & implode: 0.061879873275757 s string concat: 0.04165506362915 s array append & implode: 0.056746006011963 s
Output for 7.0.2
array append & implode: 0.052003860473633 s string concat: 0.04090404510498 s array append & implode: 0.053315162658691 s
Output for 7.0.1
array append & implode: 0.074893951416016 s string concat: 0.052099227905273 s array append & implode: 0.057337999343872 s
Output for 7.0.0
array append & implode: 0.072942018508911 s string concat: 0.049056053161621 s array append & implode: 0.055230855941772 s
Output for hhvm-3.12.0
array append & implode: 0.1618070602417 s string concat: 0.1385190486908 s array append & implode: 0.16009593009949 s
Output for hhvm-3.10.0
array append & implode: 0.262051820755 s string concat: 0.16646790504456 s array append & implode: 0.1974880695343 s
Output for 5.4.0 - 5.6.28
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 7077879 bytes) in /in/DCHmm on line 7
Process exited with code 255.
Output for 5.3.0 - 5.3.29
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 6553579 bytes) in /in/DCHmm on line 7
Process exited with code 255.
Output for 5.2.17
array append & implode: 0.13549518585205 s string concat: 0.11646699905396 s array append & implode: 0.12223196029663 s
Output for 5.2.16
array append & implode: 0.12961101531982 s string concat: 0.059849977493286 s array append & implode: 0.10715413093567 s
Output for 5.2.15
array append & implode: 0.11177897453308 s string concat: 0.061629056930542 s array append & implode: 0.11078715324402 s
Output for 5.2.14
array append & implode: 0.10756993293762 s string concat: 0.06035304069519 s array append & implode: 0.10514616966248 s
Output for 5.2.13
array append & implode: 0.10553407669067 s string concat: 0.056609869003296 s array append & implode: 0.089952945709229 s
Output for 5.2.12
array append & implode: 0.10440587997437 s string concat: 0.060121059417725 s array append & implode: 0.09688401222229 s
Output for 5.2.11
array append & implode: 0.1436460018158 s string concat: 0.063000917434692 s array append & implode: 0.10522294044495 s
Output for 5.2.10
array append & implode: 0.12141585350037 s string concat: 0.060502052307129 s array append & implode: 0.10454487800598 s
Output for 5.2.9
array append & implode: 0.12054896354675 s string concat: 0.11000680923462 s array append & implode: 0.11873292922974 s
Output for 5.2.8
array append & implode: 0.10520315170288 s string concat: 0.061084985733032 s array append & implode: 0.10631203651428 s
Output for 5.2.7
array append & implode: 0.12044906616211 s string concat: 0.10108613967896 s array append & implode: 0.099216222763062 s
Output for 5.2.6
array append & implode: 0.11732506752014 s string concat: 0.11150312423706 s array append & implode: 0.12004995346069 s
Output for 5.2.5
array append & implode: 0.12068796157837 s string concat: 0.060078144073486 s array append & implode: 0.11257600784302 s
Output for 5.2.4
array append & implode: 0.12281584739685 s string concat: 0.062932014465332 s array append & implode: 0.133957862854 s
Output for 5.2.3
array append & implode: 0.1420271396637 s string concat: 0.058976173400879 s array append & implode: 0.12943196296692 s
Output for 5.2.2
array append & implode: 0.15847706794739 s string concat: 0.063340902328491 s array append & implode: 0.12576699256897 s
Output for 5.2.1
array append & implode: 0.14222192764282 s string concat: 0.072233915328979 s array append & implode: 0.10720896720886 s
Output for 5.2.0
array append & implode: 0.1443510055542 s string concat: 0.072262048721313 s array append & implode: 0.10831379890442 s
Output for 5.1.6
array append & implode: 0.22080421447754 s string concat: 0.10080504417419 s array append & implode: 0.17791509628296 s
Output for 5.1.5
array append & implode: 0.19069886207581 s string concat: 0.095175981521606 s array append & implode: 0.18601202964783 s
Output for 5.1.4
array append & implode: 0.19692921638489 s string concat: 0.11406397819519 s array append & implode: 0.20451402664185 s
Output for 5.1.3
array append & implode: 0.21490597724915 s string concat: 0.099360942840576 s array append & implode: 0.17610192298889 s
Output for 5.1.2
array append & implode: 0.19650220870972 s string concat: 0.099234104156494 s array append & implode: 0.17717099189758 s
Output for 5.1.1
array append & implode: 0.19934320449829 s string concat: 0.10085010528564 s array append & implode: 0.17732191085815 s
Output for 5.1.0
array append & implode: 0.21211910247803 s string concat: 0.09880805015564 s array append & implode: 0.17694401741028 s
Output for 5.0.5
array append & implode: 0.21797895431519 s string concat: 0.15799593925476 s array append & implode: 0.24415302276611 s
Output for 5.0.4
array append & implode: 0.26073002815247 s string concat: 0.19241309165955 s array append & implode: 0.23831009864807 s
Output for 5.0.3
array append & implode: 0.24045014381409 s string concat: 0.14503216743469 s array append & implode: 0.2093620300293 s
Output for 5.0.2
array append & implode: 0.20960879325867 s string concat: 0.14670705795288 s array append & implode: 0.20751118659973 s
Output for 5.0.1
array append & implode: 0.25845003128052 s string concat: 0.14447903633118 s array append & implode: 0.20742011070251 s
Output for 5.0.0
array append & implode: 0.22783207893372 s string concat: 0.14400410652161 s array append & implode: 0.22087788581848 s
Output for 4.4.9
array append & implode: 0.250611 s string concat: 0.147643 s array append & implode: 0.274867 s
Output for 4.4.8
array append & implode: 0.233641 s string concat: 0.13154 s array append & implode: 0.220848 s
Output for 4.4.7
array append & implode: 0.285344 s string concat: 0.151656 s array append & implode: 0.24378 s
Output for 4.4.6
array append & implode: 0.289022 s string concat: 0.152912 s array append & implode: 0.245186 s
Output for 4.4.5
array append & implode: 0.279388 s string concat: 0.156914 s array append & implode: 0.241145 s
Output for 4.4.4
array append & implode: 0.266811 s string concat: 0.153903 s array append & implode: 0.24304 s
Output for 4.4.3
array append & implode: 0.264961 s string concat: 0.154332 s array append & implode: 0.243124 s
Output for 4.4.2
array append & implode: 0.245966 s string concat: 0.147995 s array append & implode: 0.254281 s
Output for 4.4.1
array append & implode: 0.26447 s string concat: 0.153398 s array append & implode: 0.25204 s
Output for 4.4.0
array append & implode: 0.266852 s string concat: 0.153998 s array append & implode: 0.243582 s
Output for 4.3.11
array append & implode: 0.253665 s string concat: 0.146654 s array append & implode: 0.255467 s
Output for 4.3.10
array append & implode: 0.271106 s string concat: 0.15321 s array append & implode: 0.241533 s
Output for 4.3.9
array append & implode: 0.289119 s string concat: 0.149679 s array append & implode: 0.238369 s
Output for 4.3.8
array append & implode: 0.2845 s string concat: 0.152672 s array append & implode: 0.261215 s
Output for 4.3.7
array append & implode: 0.287664 s string concat: 0.172678 s array append & implode: 0.271382 s
Output for 4.3.6
array append & implode: 0.299282 s string concat: 0.15234 s array append & implode: 0.242185 s
Output for 4.3.5
array append & implode: 0.233366 s string concat: 0.146682 s array append & implode: 0.208342 s
Output for 4.3.4
array append & implode: 0.266734 s string concat: 0.152915 s array append & implode: 0.240584 s
Output for 4.3.3
array append & implode: 0.258291 s string concat: 0.148561 s array append & implode: 0.237124 s
Output for 4.3.2
array append & implode: 0.294274 s string concat: 0.148488 s array append & implode: 0.236601 s
Output for 4.3.1
array append & implode: 0.234914 s string concat: 0.144223 s array append & implode: 0.204955 s
Output for 4.3.0
array append & implode: 0.257113 s string concat: 0.144848 s array append & implode: 0.204489 s