3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php const INT_COUNT=200000; // Fill an array with random ints $ints2 = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints2[] = rand(0, 255); } // asort the ints asort($ints2); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints2[$i]; } $finish = microtime(true); printf("Time taken with asort(): %.7f seconds\n", $finish - $start); unset($ints2); // Now do it again, but this time use sort // Fill an array with random ints $ints = array(); for ($i = 0; $i < INT_COUNT; $i++){ $ints[] = rand(0, 255); } // Sort the ints sort($ints); $start = microtime(true); // Do nothing but access each int in the array for ($i = 0; $i < INT_COUNT; $i++){ $ints[$i]; } $finish = microtime(true); printf("Time taken with sort(): %.7f seconds\n", $finish - $start);
Output for 7.1.0
Time taken with asort(): 0.0071540 seconds Time taken with sort(): 0.0048311 seconds
Output for 7.0.14
Time taken with asort(): 0.0060239 seconds Time taken with sort(): 0.0044379 seconds
Output for 7.0.10
Time taken with asort(): 0.0091670 seconds Time taken with sort(): 0.0038490 seconds
Output for 7.0.9
Time taken with asort(): 0.0082111 seconds Time taken with sort(): 0.0037930 seconds
Output for 7.0.8
Time taken with asort(): 0.0070400 seconds Time taken with sort(): 0.0037892 seconds
Output for 7.0.7
Time taken with asort(): 0.0073059 seconds Time taken with sort(): 0.0045581 seconds
Output for 7.0.6
Time taken with asort(): 0.0081930 seconds Time taken with sort(): 0.0048130 seconds
Output for 7.0.5
Time taken with asort(): 0.0076470 seconds Time taken with sort(): 0.0038500 seconds
Output for 7.0.4
Time taken with asort(): 0.0069511 seconds Time taken with sort(): 0.0038390 seconds
Output for 7.0.3
Time taken with asort(): 0.0066712 seconds Time taken with sort(): 0.0039620 seconds
Output for 7.0.2
Time taken with asort(): 0.0182869 seconds Time taken with sort(): 0.0050211 seconds
Output for 7.0.1
Time taken with asort(): 0.0132000 seconds Time taken with sort(): 0.0040748 seconds
Output for 7.0.0
Time taken with asort(): 0.0068541 seconds Time taken with sort(): 0.0039160 seconds
Output for 5.6.28
Time taken with asort(): 0.0093269 seconds Time taken with sort(): 0.0309348 seconds
Output for 5.6.25
Time taken with asort(): 0.0092080 seconds Time taken with sort(): 0.0380549 seconds
Output for 5.6.24
Time taken with asort(): 0.0098898 seconds Time taken with sort(): 0.0383461 seconds
Output for 5.6.23
Time taken with asort(): 0.0094411 seconds Time taken with sort(): 0.0336580 seconds
Output for 5.6.22
Time taken with asort(): 0.0091119 seconds Time taken with sort(): 0.0336931 seconds
Output for 5.6.21
Time taken with asort(): 0.0092518 seconds Time taken with sort(): 0.0367200 seconds
Output for 5.6.20
Time taken with asort(): 0.0090802 seconds Time taken with sort(): 0.0374970 seconds
Output for 5.6.19
Time taken with asort(): 0.0091419 seconds Time taken with sort(): 0.0352349 seconds
Output for 5.6.18
Time taken with asort(): 0.0091801 seconds Time taken with sort(): 0.0361030 seconds
Output for 5.6.17
Time taken with asort(): 0.0095851 seconds Time taken with sort(): 0.0376010 seconds
Output for 5.6.16
Time taken with asort(): 0.0090709 seconds Time taken with sort(): 0.0380991 seconds
Output for 5.6.15
Time taken with asort(): 0.0090091 seconds Time taken with sort(): 0.0361140 seconds
Output for 5.6.14
Time taken with asort(): 0.0092580 seconds Time taken with sort(): 0.0387251 seconds
Output for 5.6.13
Time taken with asort(): 0.0102949 seconds Time taken with sort(): 0.0401280 seconds
Output for 5.6.12
Time taken with asort(): 0.0092731 seconds Time taken with sort(): 0.0379219 seconds
Output for 5.6.11
Time taken with asort(): 0.0097330 seconds Time taken with sort(): 0.0375149 seconds
Output for 5.6.10
Time taken with asort(): 0.0093501 seconds Time taken with sort(): 0.0338080 seconds
Output for 5.6.9
Time taken with asort(): 0.0085511 seconds Time taken with sort(): 0.0348740 seconds
Output for 5.6.8
Time taken with asort(): 0.0086660 seconds Time taken with sort(): 0.0373390 seconds
Output for 5.6.7
Time taken with asort(): 0.0085030 seconds Time taken with sort(): 0.0355129 seconds
Output for 5.6.6
Time taken with asort(): 0.0091109 seconds Time taken with sort(): 0.0341780 seconds
Output for 5.6.5
Time taken with asort(): 0.0102692 seconds Time taken with sort(): 0.0376079 seconds
Output for 5.6.4
Time taken with asort(): 0.0090601 seconds Time taken with sort(): 0.0331061 seconds
Output for 5.6.3
Time taken with asort(): 0.0090020 seconds Time taken with sort(): 0.0367010 seconds
Output for 5.6.2
Time taken with asort(): 0.0089579 seconds Time taken with sort(): 0.0349331 seconds
Output for 5.6.1
Time taken with asort(): 0.0089679 seconds Time taken with sort(): 0.0355492 seconds
Output for 5.6.0
Time taken with asort(): 0.0085270 seconds Time taken with sort(): 0.0320840 seconds
Output for 5.5.38
Time taken with asort(): 0.0090652 seconds Time taken with sort(): 0.0371220 seconds
Output for 5.5.37
Time taken with asort(): 0.0115070 seconds Time taken with sort(): 0.0463762 seconds
Output for 5.5.36
Time taken with asort(): 0.0093510 seconds Time taken with sort(): 0.0375979 seconds
Output for 5.5.35
Time taken with asort(): 0.0092161 seconds Time taken with sort(): 0.0346940 seconds
Output for 5.5.34
Time taken with asort(): 0.0104520 seconds Time taken with sort(): 0.0395479 seconds
Output for 5.5.33
Time taken with asort(): 0.0091131 seconds Time taken with sort(): 0.0350351 seconds
Output for 5.5.32
Time taken with asort(): 0.0090392 seconds Time taken with sort(): 0.0376580 seconds
Output for 5.5.31
Time taken with asort(): 0.0093050 seconds Time taken with sort(): 0.0368130 seconds
Output for 5.5.30
Time taken with asort(): 0.0089600 seconds Time taken with sort(): 0.0365748 seconds
Output for 5.5.29
Time taken with asort(): 0.0090020 seconds Time taken with sort(): 0.0361481 seconds
Output for 5.5.28
Time taken with asort(): 0.0091379 seconds Time taken with sort(): 0.0369501 seconds
Output for 5.5.27
Time taken with asort(): 0.0104861 seconds Time taken with sort(): 0.0355809 seconds
Output for 5.5.26
Time taken with asort(): 0.0089612 seconds Time taken with sort(): 0.0365059 seconds
Output for 5.5.25
Time taken with asort(): 0.0091290 seconds Time taken with sort(): 0.0343630 seconds
Output for 5.5.24
Time taken with asort(): 0.0090170 seconds Time taken with sort(): 0.0332830 seconds
Output for 5.5.23
Time taken with asort(): 0.0090420 seconds Time taken with sort(): 0.0379810 seconds
Output for 5.5.22
Time taken with asort(): 0.0090170 seconds Time taken with sort(): 0.0335579 seconds
Output for 5.5.21
Time taken with asort(): 0.0089622 seconds Time taken with sort(): 0.0323110 seconds
Output for 5.5.20
Time taken with asort(): 0.0089159 seconds Time taken with sort(): 0.0317321 seconds
Output for 5.5.19
Time taken with asort(): 0.0091429 seconds Time taken with sort(): 0.0349119 seconds
Output for 5.5.18
Time taken with asort(): 0.0089788 seconds Time taken with sort(): 0.0356619 seconds
Output for 5.5.16
Time taken with asort(): 0.0091000 seconds Time taken with sort(): 0.0351882 seconds
Output for 5.5.15
Time taken with asort(): 0.0090120 seconds Time taken with sort(): 0.0347171 seconds
Output for 5.5.14
Time taken with asort(): 0.0089810 seconds Time taken with sort(): 0.0346730 seconds
Output for 5.5.13
Time taken with asort(): 0.0091920 seconds Time taken with sort(): 0.0364771 seconds
Output for 5.5.12
Time taken with asort(): 0.0091569 seconds Time taken with sort(): 0.0362270 seconds
Output for 5.5.11
Time taken with asort(): 0.0090179 seconds Time taken with sort(): 0.0388322 seconds
Output for 5.5.10
Time taken with asort(): 0.0090399 seconds Time taken with sort(): 0.0341330 seconds
Output for 5.5.9
Time taken with asort(): 0.0090480 seconds Time taken with sort(): 0.0358078 seconds
Output for 5.5.8
Time taken with asort(): 0.0089860 seconds Time taken with sort(): 0.0368481 seconds
Output for 5.5.7
Time taken with asort(): 0.0090830 seconds Time taken with sort(): 0.0342381 seconds
Output for 5.5.6
Time taken with asort(): 0.0091920 seconds Time taken with sort(): 0.0369380 seconds
Output for 5.5.5
Time taken with asort(): 0.0090051 seconds Time taken with sort(): 0.0350461 seconds
Output for 5.5.4
Time taken with asort(): 0.0100379 seconds Time taken with sort(): 0.0408490 seconds
Output for 5.5.3
Time taken with asort(): 0.0090780 seconds Time taken with sort(): 0.0362561 seconds
Output for 5.5.2
Time taken with asort(): 0.0091050 seconds Time taken with sort(): 0.0364668 seconds
Output for 5.5.1
Time taken with asort(): 0.0090661 seconds Time taken with sort(): 0.0381181 seconds
Output for 5.5.0
Time taken with asort(): 0.0089581 seconds Time taken with sort(): 0.0322831 seconds
Output for 5.4.45
Time taken with asort(): 0.0095038 seconds Time taken with sort(): 0.0384920 seconds
Output for 5.4.44
Time taken with asort(): 0.0095599 seconds Time taken with sort(): 0.0368371 seconds
Output for 5.4.43
Time taken with asort(): 0.0091588 seconds Time taken with sort(): 0.0365069 seconds
Output for 5.4.42
Time taken with asort(): 0.0080609 seconds Time taken with sort(): 0.0334880 seconds
Output for 5.4.41
Time taken with asort(): 0.0076880 seconds Time taken with sort(): 0.0357759 seconds
Output for 5.4.40
Time taken with asort(): 0.0093431 seconds Time taken with sort(): 0.0393469 seconds
Output for 5.4.39
Time taken with asort(): 0.0091410 seconds Time taken with sort(): 0.0349939 seconds
Output for 5.4.38
Time taken with asort(): 0.0080290 seconds Time taken with sort(): 0.0311570 seconds
Output for 5.4.37
Time taken with asort(): 0.0091040 seconds Time taken with sort(): 0.0381899 seconds
Output for 5.4.36
Time taken with asort(): 0.0089419 seconds Time taken with sort(): 0.0367770 seconds
Output for 5.4.35
Time taken with asort(): 0.0102000 seconds Time taken with sort(): 0.0370209 seconds
Output for 5.4.34
Time taken with asort(): 0.0090439 seconds Time taken with sort(): 0.0369301 seconds
Output for 5.4.32
Time taken with asort(): 0.0089829 seconds Time taken with sort(): 0.0343440 seconds
Output for 5.4.31
Time taken with asort(): 0.0098078 seconds Time taken with sort(): 0.0331991 seconds
Output for 5.4.30
Time taken with asort(): 0.0090690 seconds Time taken with sort(): 0.0365770 seconds
Output for 5.4.29
Time taken with asort(): 0.0090849 seconds Time taken with sort(): 0.0363741 seconds
Output for 5.4.28
Time taken with asort(): 0.0090110 seconds Time taken with sort(): 0.0402820 seconds
Output for 5.4.27
Time taken with asort(): 0.0091619 seconds Time taken with sort(): 0.0363622 seconds
Output for 5.4.26
Time taken with asort(): 0.0090058 seconds Time taken with sort(): 0.0353012 seconds
Output for 5.4.25
Time taken with asort(): 0.0090592 seconds Time taken with sort(): 0.0349021 seconds
Output for 5.4.24
Time taken with asort(): 0.0092778 seconds Time taken with sort(): 0.0374589 seconds
Output for 5.4.23
Time taken with asort(): 0.0122750 seconds Time taken with sort(): 0.0374029 seconds
Output for 5.4.22
Time taken with asort(): 0.0090611 seconds Time taken with sort(): 0.0348649 seconds
Output for 5.4.21
Time taken with asort(): 0.0091140 seconds Time taken with sort(): 0.0361171 seconds
Output for 5.4.20
Time taken with asort(): 0.0090981 seconds Time taken with sort(): 0.0315268 seconds
Output for 5.4.19
Time taken with asort(): 0.0090120 seconds Time taken with sort(): 0.0335879 seconds
Output for 5.4.18
Time taken with asort(): 0.0090461 seconds Time taken with sort(): 0.0372820 seconds
Output for 5.4.17
Time taken with asort(): 0.0084078 seconds Time taken with sort(): 0.0341570 seconds
Output for 5.4.16
Time taken with asort(): 0.0092652 seconds Time taken with sort(): 0.0358191 seconds
Output for 5.4.15
Time taken with asort(): 0.0091209 seconds Time taken with sort(): 0.0345411 seconds
Output for 5.4.14
Time taken with asort(): 0.0095930 seconds Time taken with sort(): 0.0371969 seconds
Output for 5.4.13
Time taken with asort(): 0.0091650 seconds Time taken with sort(): 0.0346501 seconds
Output for 5.4.12
Time taken with asort(): 0.0092170 seconds Time taken with sort(): 0.0341651 seconds
Output for 5.4.11
Time taken with asort(): 0.0090442 seconds Time taken with sort(): 0.0349491 seconds
Output for 5.4.10
Time taken with asort(): 0.0090759 seconds Time taken with sort(): 0.0349350 seconds
Output for 5.4.9
Time taken with asort(): 0.0091000 seconds Time taken with sort(): 0.0351059 seconds
Output for 5.4.8
Time taken with asort(): 0.0093789 seconds Time taken with sort(): 0.0362091 seconds
Output for 5.4.7
Time taken with asort(): 0.0092571 seconds Time taken with sort(): 0.0354950 seconds
Output for 5.4.6
Time taken with asort(): 0.0090990 seconds Time taken with sort(): 0.0363641 seconds
Output for 5.4.5
Time taken with asort(): 0.0097151 seconds Time taken with sort(): 0.0376441 seconds
Output for 5.4.4
Time taken with asort(): 0.0113618 seconds Time taken with sort(): 0.0337758 seconds
Output for 5.4.3
Time taken with asort(): 0.0090489 seconds Time taken with sort(): 0.0395920 seconds
Output for 5.4.2
Time taken with asort(): 0.0075161 seconds Time taken with sort(): 0.0319030 seconds
Output for 5.4.1
Time taken with asort(): 0.0089259 seconds Time taken with sort(): 0.0343261 seconds
Output for 5.4.0
Time taken with asort(): 0.0091701 seconds Time taken with sort(): 0.0350020 seconds
Output for 5.3.29
Time taken with asort(): 0.0141799 seconds Time taken with sort(): 0.0294011 seconds
Output for 5.3.28
Time taken with asort(): 0.0141659 seconds Time taken with sort(): 0.0323241 seconds
Output for 5.3.27
Time taken with asort(): 0.0144069 seconds Time taken with sort(): 0.0325961 seconds
Output for 5.3.26
Time taken with asort(): 0.0143530 seconds Time taken with sort(): 0.0294099 seconds
Output for 5.3.25
Time taken with asort(): 0.0145721 seconds Time taken with sort(): 0.0312741 seconds
Output for 5.3.24
Time taken with asort(): 0.0146980 seconds Time taken with sort(): 0.0322211 seconds
Output for 5.3.23
Time taken with asort(): 0.0143428 seconds Time taken with sort(): 0.0310900 seconds
Output for 5.3.22
Time taken with asort(): 0.0144839 seconds Time taken with sort(): 0.0295279 seconds
Output for 5.3.21
Time taken with asort(): 0.0141811 seconds Time taken with sort(): 0.0292339 seconds
Output for 5.3.20
Time taken with asort(): 0.0153050 seconds Time taken with sort(): 0.0304000 seconds
Output for 5.3.19
Time taken with asort(): 0.0142288 seconds Time taken with sort(): 0.0291169 seconds
Output for 5.3.18
Time taken with asort(): 0.0148711 seconds Time taken with sort(): 0.0332520 seconds
Output for 5.3.17
Time taken with asort(): 0.0142150 seconds Time taken with sort(): 0.0296359 seconds
Output for 5.3.16
Time taken with asort(): 0.0143709 seconds Time taken with sort(): 0.0299911 seconds
Output for 5.3.15
Time taken with asort(): 0.0147130 seconds Time taken with sort(): 0.0300331 seconds
Output for 5.3.14
Time taken with asort(): 0.0149961 seconds Time taken with sort(): 0.0302799 seconds
Output for 5.3.13
Time taken with asort(): 0.0145059 seconds Time taken with sort(): 0.0287161 seconds
Output for 5.3.12
Time taken with asort(): 0.0121400 seconds Time taken with sort(): 0.0298848 seconds
Output for 5.3.11
Time taken with asort(): 0.0142841 seconds Time taken with sort(): 0.0296168 seconds
Output for 5.3.10
Time taken with asort(): 0.0130141 seconds Time taken with sort(): 0.0267680 seconds
Output for 5.3.9
Time taken with asort(): 0.0150180 seconds Time taken with sort(): 0.0303428 seconds
Output for 5.3.8
Time taken with asort(): 0.0143871 seconds Time taken with sort(): 0.0322721 seconds
Output for 5.3.7
Time taken with asort(): 0.0142360 seconds Time taken with sort(): 0.0279040 seconds
Output for 5.3.6
Time taken with asort(): 0.0151081 seconds Time taken with sort(): 0.0273390 seconds
Output for 5.3.5
Time taken with asort(): 0.0143001 seconds Time taken with sort(): 0.0279841 seconds
Output for 5.3.4
Time taken with asort(): 0.0145621 seconds Time taken with sort(): 0.0295639 seconds
Output for 5.3.3
Time taken with asort(): 0.0157590 seconds Time taken with sort(): 0.0312719 seconds
Output for 5.3.2
Time taken with asort(): 0.0143089 seconds Time taken with sort(): 0.0328171 seconds
Output for 5.3.1
Time taken with asort(): 0.0146301 seconds Time taken with sort(): 0.0294960 seconds
Output for 5.3.0
Time taken with asort(): 0.0144529 seconds Time taken with sort(): 0.0296860 seconds
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/p9U9N on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected T_CONST in /in/p9U9N on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/p9U9N on line 3
Process exited with code 255.