3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php const INT_COUNT = 100000; // 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($ints); // 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.0031021 seconds Time taken with sort(): 0.0023980 seconds
Output for 7.0.14
Time taken with asort(): 0.0032361 seconds Time taken with sort(): 0.0026631 seconds
Output for 7.0.7
Time taken with asort(): 0.0031228 seconds Time taken with sort(): 0.0019920 seconds
Output for 7.0.6
Time taken with asort(): 0.0036671 seconds Time taken with sort(): 0.0023429 seconds
Output for 7.0.5
Time taken with asort(): 0.0032899 seconds Time taken with sort(): 0.0020189 seconds
Output for 7.0.4
Time taken with asort(): 0.0033400 seconds Time taken with sort(): 0.0020339 seconds
Output for 7.0.3
Time taken with asort(): 0.0039761 seconds Time taken with sort(): 0.0022581 seconds
Output for 7.0.2
Time taken with asort(): 0.0037830 seconds Time taken with sort(): 0.0024400 seconds
Output for 7.0.1
Time taken with asort(): 0.0035949 seconds Time taken with sort(): 0.0023561 seconds
Output for 7.0.0
Time taken with asort(): 0.0035470 seconds Time taken with sort(): 0.0020618 seconds
Output for 5.6.28
Time taken with asort(): -0.0056341 seconds Time taken with sort(): -0.0141969 seconds
Output for 5.6.22
Time taken with asort(): 0.0059810 seconds Time taken with sort(): 0.0101371 seconds
Output for 5.6.21
Time taken with asort(): 0.0050821 seconds Time taken with sort(): 0.0107162 seconds
Output for 5.6.20
Time taken with asort(): 0.0046129 seconds Time taken with sort(): 0.0110760 seconds
Output for 5.6.19
Time taken with asort(): 0.0051570 seconds Time taken with sort(): 0.0103190 seconds
Output for 5.6.18
Time taken with asort(): 0.0046639 seconds Time taken with sort(): 0.0136819 seconds
Output for 5.6.17
Time taken with asort(): 0.0044179 seconds Time taken with sort(): 0.0096469 seconds
Output for 5.6.16
Time taken with asort(): 0.0073462 seconds Time taken with sort(): 0.0173299 seconds
Output for 5.6.15
Time taken with asort(): 0.0056121 seconds Time taken with sort(): 0.0102279 seconds
Output for 5.6.14
Time taken with asort(): 0.0044630 seconds Time taken with sort(): 0.0109191 seconds
Output for 5.6.13
Time taken with asort(): 0.0051141 seconds Time taken with sort(): 0.0102241 seconds
Output for 5.6.12
Time taken with asort(): 0.0052049 seconds Time taken with sort(): 0.0115290 seconds
Output for 5.6.11
Time taken with asort(): 0.0055220 seconds Time taken with sort(): 0.0117321 seconds
Output for 5.6.10
Time taken with asort(): 0.0055091 seconds Time taken with sort(): 0.0128679 seconds
Output for 5.6.9
Time taken with asort(): 0.0056019 seconds Time taken with sort(): 0.0103378 seconds
Output for 5.6.8
Time taken with asort(): 0.0046251 seconds Time taken with sort(): 0.0114701 seconds
Output for 5.6.7
Time taken with asort(): 0.0045040 seconds Time taken with sort(): 0.0107121 seconds
Output for 5.6.6
Time taken with asort(): 0.0052149 seconds Time taken with sort(): 0.0112832 seconds
Output for 5.6.5
Time taken with asort(): 0.0049851 seconds Time taken with sort(): 0.0106990 seconds
Output for 5.6.4
Time taken with asort(): 0.0049832 seconds Time taken with sort(): 0.0113308 seconds
Output for 5.6.3
Time taken with asort(): 0.0057070 seconds Time taken with sort(): 0.0110040 seconds
Output for 5.6.2
Time taken with asort(): 0.0049291 seconds Time taken with sort(): 0.0107720 seconds
Output for 5.6.1
Time taken with asort(): 0.0053589 seconds Time taken with sort(): 0.0115480 seconds
Output for 5.6.0
Time taken with asort(): 0.0055640 seconds Time taken with sort(): 0.0117800 seconds
Output for 5.5.36
Time taken with asort(): 0.0053201 seconds Time taken with sort(): 0.0098460 seconds
Output for 5.5.35
Time taken with asort(): 0.0057991 seconds Time taken with sort(): 0.0108340 seconds
Output for 5.5.34
Time taken with asort(): 0.0043619 seconds Time taken with sort(): 0.0090570 seconds
Output for 5.5.33
Time taken with asort(): 0.0044391 seconds Time taken with sort(): 0.0136330 seconds
Output for 5.5.32
Time taken with asort(): 0.0045829 seconds Time taken with sort(): 0.0126691 seconds
Output for 5.5.31
Time taken with asort(): 0.0046749 seconds Time taken with sort(): 0.0109420 seconds
Output for 5.5.30
Time taken with asort(): 0.0054181 seconds Time taken with sort(): 0.0109868 seconds
Output for 5.5.29
Time taken with asort(): 0.0044351 seconds Time taken with sort(): 0.0093620 seconds
Output for 5.5.28
Time taken with asort(): 0.0056598 seconds Time taken with sort(): 0.0120289 seconds
Output for 5.5.27
Time taken with asort(): 0.0049131 seconds Time taken with sort(): 0.0111661 seconds
Output for 5.5.26
Time taken with asort(): 0.0051911 seconds Time taken with sort(): 0.0104971 seconds
Output for 5.5.25
Time taken with asort(): 0.0045731 seconds Time taken with sort(): 0.0109639 seconds
Output for 5.5.24
Time taken with asort(): 0.0044179 seconds Time taken with sort(): 0.0105829 seconds
Output for 5.5.23
Time taken with asort(): 0.0044792 seconds Time taken with sort(): 0.0116541 seconds
Output for 5.5.22
Time taken with asort(): 0.0045211 seconds Time taken with sort(): 0.0108719 seconds
Output for 5.5.21
Time taken with asort(): 0.0052772 seconds Time taken with sort(): 0.0113721 seconds
Output for 5.5.20
Time taken with asort(): 0.0043900 seconds Time taken with sort(): 0.0104680 seconds
Output for 5.5.19
Time taken with asort(): 0.0043600 seconds Time taken with sort(): 0.0128210 seconds
Output for 5.5.18
Time taken with asort(): 0.0056410 seconds Time taken with sort(): 0.0108709 seconds
Output for 5.5.16
Time taken with asort(): 0.0049942 seconds Time taken with sort(): 0.0116830 seconds
Output for 5.5.15
Time taken with asort(): 0.0053942 seconds Time taken with sort(): 0.0111768 seconds
Output for 5.5.14
Time taken with asort(): 0.0044010 seconds Time taken with sort(): 0.0104570 seconds
Output for 5.5.13
Time taken with asort(): 0.0057659 seconds Time taken with sort(): 0.0119550 seconds
Output for 5.5.12
Time taken with asort(): 0.0055580 seconds Time taken with sort(): 0.0119901 seconds
Output for 5.5.11
Time taken with asort(): 0.0055060 seconds Time taken with sort(): 0.0114341 seconds
Output for 5.5.10
Time taken with asort(): 0.0053811 seconds Time taken with sort(): 0.0103211 seconds
Output for 5.5.9
Time taken with asort(): 0.0056000 seconds Time taken with sort(): 0.0104449 seconds
Output for 5.5.8
Time taken with asort(): 0.0050251 seconds Time taken with sort(): 0.0115190 seconds
Output for 5.5.7
Time taken with asort(): 0.0045781 seconds Time taken with sort(): 0.0115671 seconds
Output for 5.5.6
Time taken with asort(): 0.0046079 seconds Time taken with sort(): 0.0114639 seconds
Output for 5.5.5
Time taken with asort(): 0.0045531 seconds Time taken with sort(): 0.0126441 seconds
Output for 5.5.4
Time taken with asort(): 0.0056329 seconds Time taken with sort(): 0.0107679 seconds
Output for 5.5.3
Time taken with asort(): 0.0050709 seconds Time taken with sort(): 0.0114810 seconds
Output for 5.5.2
Time taken with asort(): 0.0046360 seconds Time taken with sort(): 0.0104280 seconds
Output for 5.5.1
Time taken with asort(): 0.0052001 seconds Time taken with sort(): 0.0114200 seconds
Output for 5.5.0
Time taken with asort(): 0.0044160 seconds Time taken with sort(): 0.0111909 seconds
Output for 5.4.45
Time taken with asort(): 0.0046611 seconds Time taken with sort(): 0.0150008 seconds
Output for 5.4.44
Time taken with asort(): 0.0053039 seconds Time taken with sort(): 0.0109081 seconds
Output for 5.4.43
Time taken with asort(): 0.0046320 seconds Time taken with sort(): 0.0110381 seconds
Output for 5.4.42
Time taken with asort(): 0.0055490 seconds Time taken with sort(): 0.0121920 seconds
Output for 5.4.41
Time taken with asort(): 0.0047331 seconds Time taken with sort(): 0.0120592 seconds
Output for 5.4.40
Time taken with asort(): 0.0057321 seconds Time taken with sort(): 0.0119569 seconds
Output for 5.4.39
Time taken with asort(): 0.0052059 seconds Time taken with sort(): 0.0112262 seconds
Output for 5.4.38
Time taken with asort(): 0.0043950 seconds Time taken with sort(): 0.0113060 seconds
Output for 5.4.37
Time taken with asort(): 0.0044470 seconds Time taken with sort(): 0.0119789 seconds
Output for 5.4.36
Time taken with asort(): 0.0046499 seconds Time taken with sort(): 0.0112350 seconds
Output for 5.4.35
Time taken with asort(): 0.0051939 seconds Time taken with sort(): 0.0111251 seconds
Output for 5.4.34
Time taken with asort(): 0.0058599 seconds Time taken with sort(): 0.0117011 seconds
Output for 5.4.32
Time taken with asort(): 0.0051880 seconds Time taken with sort(): 0.0107782 seconds
Output for 5.4.31
Time taken with asort(): 0.0044219 seconds Time taken with sort(): 0.0109639 seconds
Output for 5.4.30
Time taken with asort(): 0.0043991 seconds Time taken with sort(): 0.0112000 seconds
Output for 5.4.29
Time taken with asort(): 0.0044041 seconds Time taken with sort(): 0.0108120 seconds
Output for 5.4.28
Time taken with asort(): 0.0057728 seconds Time taken with sort(): 0.0121810 seconds
Output for 5.4.27
Time taken with asort(): 0.0048559 seconds Time taken with sort(): 0.0111201 seconds
Output for 5.4.26
Time taken with asort(): 0.0057411 seconds Time taken with sort(): 0.0117469 seconds
Output for 5.4.25
Time taken with asort(): 0.0044091 seconds Time taken with sort(): 0.0110579 seconds
Output for 5.4.24
Time taken with asort(): 0.0060978 seconds Time taken with sort(): 0.0127351 seconds
Output for 5.4.23
Time taken with asort(): 0.0054021 seconds Time taken with sort(): 0.0121839 seconds
Output for 5.4.22
Time taken with asort(): 0.0049291 seconds Time taken with sort(): 0.0123000 seconds
Output for 5.4.21
Time taken with asort(): 0.0048470 seconds Time taken with sort(): 0.0107851 seconds
Output for 5.4.20
Time taken with asort(): 0.0055060 seconds Time taken with sort(): 0.0110252 seconds
Output for 5.4.19
Time taken with asort(): 0.0047898 seconds Time taken with sort(): 0.0117459 seconds
Output for 5.4.18
Time taken with asort(): 0.0055740 seconds Time taken with sort(): 0.0110710 seconds
Output for 5.4.17
Time taken with asort(): 0.0049360 seconds Time taken with sort(): 0.0115411 seconds
Output for 5.4.16
Time taken with asort(): 0.0051188 seconds Time taken with sort(): 0.0112190 seconds
Output for 5.4.15
Time taken with asort(): 0.0057530 seconds Time taken with sort(): 0.0113699 seconds
Output for 5.4.14
Time taken with asort(): 0.0044320 seconds Time taken with sort(): 0.0101869 seconds
Output for 5.4.13
Time taken with asort(): 0.0045290 seconds Time taken with sort(): 0.0104949 seconds
Output for 5.4.12
Time taken with asort(): 0.0046399 seconds Time taken with sort(): 0.0125301 seconds
Output for 5.4.11
Time taken with asort(): 0.0056231 seconds Time taken with sort(): 0.0106399 seconds
Output for 5.4.10
Time taken with asort(): 0.0045791 seconds Time taken with sort(): 0.0112250 seconds
Output for 5.4.9
Time taken with asort(): 0.0054159 seconds Time taken with sort(): 0.0104771 seconds
Output for 5.4.8
Time taken with asort(): 0.0059741 seconds Time taken with sort(): 0.0115662 seconds
Output for 5.4.7
Time taken with asort(): 0.0056448 seconds Time taken with sort(): 0.0111189 seconds
Output for 5.4.6
Time taken with asort(): 0.0046179 seconds Time taken with sort(): 0.0106258 seconds
Output for 5.4.5
Time taken with asort(): 0.0043850 seconds Time taken with sort(): 0.0103328 seconds
Output for 5.4.4
Time taken with asort(): 0.0044591 seconds Time taken with sort(): 0.0155158 seconds
Output for 5.4.3
Time taken with asort(): 0.0045781 seconds Time taken with sort(): 0.0155790 seconds
Output for 5.4.2
Time taken with asort(): 0.0044200 seconds Time taken with sort(): 0.0150650 seconds
Output for 5.4.1
Time taken with asort(): 0.0047240 seconds Time taken with sort(): 0.0139899 seconds
Output for 5.4.0
Time taken with asort(): 0.0044491 seconds Time taken with sort(): 0.0158060 seconds
Output for 5.3.29
Time taken with asort(): 0.0077739 seconds Time taken with sort(): 0.0107970 seconds
Output for 5.3.28
Time taken with asort(): 0.0077832 seconds Time taken with sort(): 0.0124319 seconds
Output for 5.3.27
Time taken with asort(): 0.0069981 seconds Time taken with sort(): 0.0105641 seconds
Output for 5.3.26
Time taken with asort(): 0.0078239 seconds Time taken with sort(): 0.0114882 seconds
Output for 5.3.25
Time taken with asort(): 0.0080469 seconds Time taken with sort(): 0.0108430 seconds
Output for 5.3.24
Time taken with asort(): 0.0094039 seconds Time taken with sort(): 0.0113850 seconds
Output for 5.3.23
Time taken with asort(): 0.0077720 seconds Time taken with sort(): 0.0127711 seconds
Output for 5.3.22
Time taken with asort(): 0.0080140 seconds Time taken with sort(): 0.0101509 seconds
Output for 5.3.21
Time taken with asort(): 0.0075471 seconds Time taken with sort(): 0.0111980 seconds
Output for 5.3.20
Time taken with asort(): 0.0090561 seconds Time taken with sort(): 0.0106890 seconds
Output for 5.3.19
Time taken with asort(): 0.0073240 seconds Time taken with sort(): 0.0105882 seconds
Output for 5.3.18
Time taken with asort(): 0.0077682 seconds Time taken with sort(): 0.0101590 seconds
Output for 5.3.17
Time taken with asort(): 0.0082371 seconds Time taken with sort(): 0.0102272 seconds
Output for 5.3.16
Time taken with asort(): 0.0082960 seconds Time taken with sort(): 0.0111401 seconds
Output for 5.3.15
Time taken with asort(): 0.0070059 seconds Time taken with sort(): 0.0102329 seconds
Output for 5.3.14
Time taken with asort(): 0.0075850 seconds Time taken with sort(): 0.0144999 seconds
Output for 5.3.13
Time taken with asort(): 0.0079360 seconds Time taken with sort(): 0.0158889 seconds
Output for 5.3.12
Time taken with asort(): 0.0071039 seconds Time taken with sort(): 0.0150211 seconds
Output for 5.3.11
Time taken with asort(): 0.0073130 seconds Time taken with sort(): 0.0100191 seconds
Output for 5.3.10
Time taken with asort(): 0.0070741 seconds Time taken with sort(): 0.0137730 seconds
Output for 5.3.9
Time taken with asort(): 0.0072379 seconds Time taken with sort(): 0.0156970 seconds
Output for 5.3.8
Time taken with asort(): 0.0072160 seconds Time taken with sort(): 0.0141690 seconds
Output for 5.3.7
Time taken with asort(): 0.0090499 seconds Time taken with sort(): 0.0145838 seconds
Output for 5.3.6
Time taken with asort(): 0.0071330 seconds Time taken with sort(): 0.0143900 seconds
Output for 5.3.5
Time taken with asort(): 0.0071280 seconds Time taken with sort(): 0.0137110 seconds
Output for 5.3.4
Time taken with asort(): 0.0071130 seconds Time taken with sort(): 0.0130641 seconds
Output for 5.3.3
Time taken with asort(): 0.0072908 seconds Time taken with sort(): 0.0140650 seconds
Output for 5.3.2
Time taken with asort(): 0.0070770 seconds Time taken with sort(): 0.0145910 seconds
Output for 5.3.1
Time taken with asort(): 0.0062332 seconds Time taken with sort(): 0.0121429 seconds
Output for 5.3.0
Time taken with asort(): 0.0062821 seconds Time taken with sort(): 0.0140450 seconds
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/s2gv6 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/s2gv6 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/s2gv6 on line 3
Process exited with code 255.