3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php const INT_COUNT = 100000; // 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); unset($ints); // Now do it again, but this time use an asort // 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);
Output for 7.1.0
Time taken with sort(): 0.0025818 seconds Time taken with asort(): 0.0027618 seconds
Output for 7.0.14
Time taken with sort(): 0.0028341 seconds Time taken with asort(): 0.0028911 seconds
Output for 7.0.8
Time taken with sort(): 0.0018799 seconds Time taken with asort(): 0.0025449 seconds
Output for 7.0.7
Time taken with sort(): 0.0021129 seconds Time taken with asort(): 0.0029371 seconds
Output for 7.0.6
Time taken with sort(): 0.0018911 seconds Time taken with asort(): 0.0029640 seconds
Output for 7.0.5
Time taken with sort(): 0.0015810 seconds Time taken with asort(): 0.0022562 seconds
Output for 7.0.4
Time taken with sort(): 0.0019560 seconds Time taken with asort(): 0.0025401 seconds
Output for 7.0.3
Time taken with sort(): 0.0019870 seconds Time taken with asort(): 0.0025589 seconds
Output for 7.0.2
Time taken with sort(): 0.0019541 seconds Time taken with asort(): 0.0026488 seconds
Output for 7.0.1
Time taken with sort(): 0.0020070 seconds Time taken with asort(): 0.0026040 seconds
Output for 7.0.0
Time taken with sort(): 0.0019379 seconds Time taken with asort(): 0.0025680 seconds
Output for hhvm-3.12.0
Time taken with sort(): 0.0073009 seconds Time taken with asort(): 0.0080440 seconds
Output for hhvm-3.10.0
Time taken with sort(): 0.0078502 seconds Time taken with asort(): 0.0087340 seconds
Output for 5.6.28
Time taken with sort(): 0.0157490 seconds Time taken with asort(): 0.0056651 seconds
Output for 5.6.23
Time taken with sort(): 0.0117741 seconds Time taken with asort(): 0.0057580 seconds
Output for 5.6.22
Time taken with sort(): 0.0145810 seconds Time taken with asort(): 0.0057139 seconds
Output for 5.6.21
Time taken with sort(): 0.0151172 seconds Time taken with asort(): 0.0057671 seconds
Output for 5.6.20
Time taken with sort(): 0.0130491 seconds Time taken with asort(): 0.0052750 seconds
Output for 5.6.19
Time taken with sort(): 0.0143750 seconds Time taken with asort(): 0.0059750 seconds
Output for 5.6.18
Time taken with sort(): 0.0132251 seconds Time taken with asort(): 0.0050099 seconds
Output for 5.6.17
Time taken with sort(): 0.0137680 seconds Time taken with asort(): 0.0056899 seconds
Output for 5.6.16
Time taken with sort(): 0.0147090 seconds Time taken with asort(): 0.0054440 seconds
Output for 5.6.15
Time taken with sort(): 0.0115900 seconds Time taken with asort(): 0.0054390 seconds
Output for 5.6.14
Time taken with sort(): 0.0150440 seconds Time taken with asort(): 0.0060098 seconds
Output for 5.6.13
Time taken with sort(): 0.0155311 seconds Time taken with asort(): 0.0061018 seconds
Output for 5.6.12
Time taken with sort(): 0.0128679 seconds Time taken with asort(): 0.0062299 seconds
Output for 5.6.11
Time taken with sort(): 0.0128312 seconds Time taken with asort(): 0.0055761 seconds
Output for 5.6.10
Time taken with sort(): 0.0122619 seconds Time taken with asort(): 0.0076702 seconds
Output for 5.6.9
Time taken with sort(): 0.0139761 seconds Time taken with asort(): 0.0067508 seconds
Output for 5.6.8
Time taken with sort(): 0.0139720 seconds Time taken with asort(): 0.0076151 seconds
Output for 5.6.7
Time taken with sort(): 0.0122819 seconds Time taken with asort(): 0.0055451 seconds
Output for 5.6.6
Time taken with sort(): 0.0132880 seconds Time taken with asort(): 0.0057371 seconds
Output for 5.6.5
Time taken with sort(): 0.0136151 seconds Time taken with asort(): 0.0057449 seconds
Output for 5.6.4
Time taken with sort(): 0.0122368 seconds Time taken with asort(): 0.0057280 seconds
Output for 5.6.3
Time taken with sort(): 0.0125222 seconds Time taken with asort(): 0.0058489 seconds
Output for 5.6.2
Time taken with sort(): 0.0117321 seconds Time taken with asort(): 0.0056181 seconds
Output for 5.6.1
Time taken with sort(): 0.0112178 seconds Time taken with asort(): 0.0056682 seconds
Output for 5.6.0
Time taken with sort(): 0.0122800 seconds Time taken with asort(): 0.0057111 seconds
Output for 5.5.37
Time taken with sort(): 0.0137010 seconds Time taken with asort(): 0.0058582 seconds
Output for 5.5.36
Time taken with sort(): 0.0155301 seconds Time taken with asort(): 0.0060549 seconds
Output for 5.5.35
Time taken with sort(): 0.0149469 seconds Time taken with asort(): 0.0054040 seconds
Output for 5.5.34
Time taken with sort(): 0.0132759 seconds Time taken with asort(): 0.0051200 seconds
Output for 5.5.33
Time taken with sort(): 0.0141909 seconds Time taken with asort(): 0.0057042 seconds
Output for 5.5.32
Time taken with sort(): 0.0125821 seconds Time taken with asort(): 0.0057631 seconds
Output for 5.5.31
Time taken with sort(): 0.0135279 seconds Time taken with asort(): 0.0056949 seconds
Output for 5.5.30
Time taken with sort(): 0.0126860 seconds Time taken with asort(): 0.0052660 seconds
Output for 5.5.29
Time taken with sort(): 0.0123000 seconds Time taken with asort(): 0.0054951 seconds
Output for 5.5.28
Time taken with sort(): 0.0136330 seconds Time taken with asort(): 0.0056300 seconds
Output for 5.5.27
Time taken with sort(): 0.0130079 seconds Time taken with asort(): 0.0062621 seconds
Output for 5.5.26
Time taken with sort(): 0.0113940 seconds Time taken with asort(): 0.0058680 seconds
Output for 5.5.25
Time taken with sort(): 0.0119059 seconds Time taken with asort(): 0.0056682 seconds
Output for 5.5.24
Time taken with sort(): 0.0126491 seconds Time taken with asort(): 0.0054450 seconds
Output for 5.5.23
Time taken with sort(): 0.0117168 seconds Time taken with asort(): 0.0055900 seconds
Output for 5.5.22
Time taken with sort(): 0.0137179 seconds Time taken with asort(): 0.0054851 seconds
Output for 5.5.21
Time taken with sort(): 0.0123260 seconds Time taken with asort(): 0.0055881 seconds
Output for 5.5.20
Time taken with sort(): 0.0111339 seconds Time taken with asort(): 0.0056570 seconds
Output for 5.5.19
Time taken with sort(): 0.0145040 seconds Time taken with asort(): 0.0072651 seconds
Output for 5.5.18
Time taken with sort(): 0.0115199 seconds Time taken with asort(): 0.0056350 seconds
Output for 5.5.16
Time taken with sort(): 0.0122979 seconds Time taken with asort(): 0.0056050 seconds
Output for 5.5.15
Time taken with sort(): 0.0124331 seconds Time taken with asort(): 0.0055170 seconds
Output for 5.5.14
Time taken with sort(): 0.0123820 seconds Time taken with asort(): 0.0056269 seconds
Output for 5.5.13
Time taken with sort(): 0.0138001 seconds Time taken with asort(): 0.0058651 seconds
Output for 5.5.12
Time taken with sort(): 0.0120070 seconds Time taken with asort(): 0.0057311 seconds
Output for 5.5.11
Time taken with sort(): 0.0134940 seconds Time taken with asort(): 0.0056570 seconds
Output for 5.5.10
Time taken with sort(): 0.0140431 seconds Time taken with asort(): 0.0058260 seconds
Output for 5.5.9
Time taken with sort(): 0.0110080 seconds Time taken with asort(): 0.0055740 seconds
Output for 5.5.8
Time taken with sort(): 0.0134130 seconds Time taken with asort(): 0.0054588 seconds
Output for 5.5.7
Time taken with sort(): 0.0118599 seconds Time taken with asort(): 0.0056579 seconds
Output for 5.5.6
Time taken with sort(): 0.0138159 seconds Time taken with asort(): 0.0054970 seconds
Output for 5.5.5
Time taken with sort(): 0.0136828 seconds Time taken with asort(): 0.0057318 seconds
Output for 5.5.4
Time taken with sort(): 0.0130310 seconds Time taken with asort(): 0.0056391 seconds
Output for 5.5.3
Time taken with sort(): 0.0125430 seconds Time taken with asort(): 0.0065289 seconds
Output for 5.5.2
Time taken with sort(): 0.0150862 seconds Time taken with asort(): 0.0059950 seconds
Output for 5.5.1
Time taken with sort(): 0.0135212 seconds Time taken with asort(): 0.0058320 seconds
Output for 5.5.0
Time taken with sort(): 0.0138221 seconds Time taken with asort(): 0.0062082 seconds
Output for 5.4.45
Time taken with sort(): 0.0135090 seconds Time taken with asort(): 0.0059440 seconds
Output for 5.4.44
Time taken with sort(): 0.0141051 seconds Time taken with asort(): 0.0057969 seconds
Output for 5.4.43
Time taken with sort(): 0.0123689 seconds Time taken with asort(): 0.0059249 seconds
Output for 5.4.42
Time taken with sort(): 0.0143569 seconds Time taken with asort(): 0.0061829 seconds
Output for 5.4.41
Time taken with sort(): 0.0156169 seconds Time taken with asort(): 0.0058980 seconds
Output for 5.4.40
Time taken with sort(): 0.0132380 seconds Time taken with asort(): 0.0059109 seconds
Output for 5.4.39
Time taken with sort(): 0.0120330 seconds Time taken with asort(): 0.0060971 seconds
Output for 5.4.38
Time taken with sort(): 0.0128272 seconds Time taken with asort(): 0.0057750 seconds
Output for 5.4.37
Time taken with sort(): 0.0131640 seconds Time taken with asort(): 0.0058219 seconds
Output for 5.4.36
Time taken with sort(): 0.0128930 seconds Time taken with asort(): 0.0064220 seconds
Output for 5.4.35
Time taken with sort(): 0.0117929 seconds Time taken with asort(): 0.0061510 seconds
Output for 5.4.34
Time taken with sort(): 0.0120020 seconds Time taken with asort(): 0.0061970 seconds
Output for 5.4.32
Time taken with sort(): 0.0120311 seconds Time taken with asort(): 0.0057850 seconds
Output for 5.4.31
Time taken with sort(): 0.0125730 seconds Time taken with asort(): 0.0057819 seconds
Output for 5.4.30
Time taken with sort(): 0.0122211 seconds Time taken with asort(): 0.0058069 seconds
Output for 5.4.29
Time taken with sort(): 0.0137641 seconds Time taken with asort(): 0.0061879 seconds
Output for 5.4.28
Time taken with sort(): 0.0117581 seconds Time taken with asort(): 0.0058479 seconds
Output for 5.4.27
Time taken with sort(): 0.0124459 seconds Time taken with asort(): 0.0057650 seconds
Output for 5.4.26
Time taken with sort(): 0.0116732 seconds Time taken with asort(): 0.0055830 seconds
Output for 5.4.25
Time taken with sort(): 0.0130630 seconds Time taken with asort(): 0.0054910 seconds
Output for 5.4.24
Time taken with sort(): 0.0128992 seconds Time taken with asort(): 0.0057590 seconds
Output for 5.4.23
Time taken with sort(): 0.0116222 seconds Time taken with asort(): 0.0055079 seconds
Output for 5.4.22
Time taken with sort(): 0.0132840 seconds Time taken with asort(): 0.0056949 seconds
Output for 5.4.21
Time taken with sort(): 0.0121982 seconds Time taken with asort(): 0.0056829 seconds
Output for 5.4.20
Time taken with sort(): 0.0125129 seconds Time taken with asort(): 0.0056651 seconds
Output for 5.4.19
Time taken with sort(): 0.0139380 seconds Time taken with asort(): 0.0066969 seconds
Output for 5.4.18
Time taken with sort(): 0.0130401 seconds Time taken with asort(): 0.0058820 seconds
Output for 5.4.17
Time taken with sort(): 0.0145860 seconds Time taken with asort(): 0.0057271 seconds
Output for 5.4.16
Time taken with sort(): 0.0124121 seconds Time taken with asort(): 0.0056992 seconds
Output for 5.4.15
Time taken with sort(): 0.0113802 seconds Time taken with asort(): 0.0057230 seconds
Output for 5.4.14
Time taken with sort(): 0.0118370 seconds Time taken with asort(): 0.0055902 seconds
Output for 5.4.13
Time taken with sort(): 0.0123181 seconds Time taken with asort(): 0.0055931 seconds
Output for 5.4.12
Time taken with sort(): 0.0131371 seconds Time taken with asort(): 0.0051491 seconds
Output for 5.4.11
Time taken with sort(): 0.0104880 seconds Time taken with asort(): 0.0051270 seconds
Output for 5.4.10
Time taken with sort(): 0.0129731 seconds Time taken with asort(): 0.0063438 seconds
Output for 5.4.9
Time taken with sort(): 0.0148978 seconds Time taken with asort(): 0.0056419 seconds
Output for 5.4.8
Time taken with sort(): 0.0156538 seconds Time taken with asort(): 0.0071509 seconds
Output for 5.4.7
Time taken with sort(): 0.0125790 seconds Time taken with asort(): 0.0058060 seconds
Output for 5.4.6
Time taken with sort(): 0.0129561 seconds Time taken with asort(): 0.0056710 seconds
Output for 5.4.5
Time taken with sort(): 0.0122991 seconds Time taken with asort(): 0.0054851 seconds
Output for 5.4.4
Time taken with sort(): 0.0143900 seconds Time taken with asort(): 0.0056989 seconds
Output for 5.4.3
Time taken with sort(): 0.0134799 seconds Time taken with asort(): 0.0064371 seconds
Output for 5.4.2
Time taken with sort(): 0.0181830 seconds Time taken with asort(): 0.0058858 seconds
Output for 5.4.1
Time taken with sort(): 0.0167580 seconds Time taken with asort(): 0.0080969 seconds
Output for 5.4.0
Time taken with sort(): 0.0145471 seconds Time taken with asort(): 0.0056179 seconds
Output for 5.3.29
Time taken with sort(): 0.0111420 seconds Time taken with asort(): 0.0078549 seconds
Output for 5.3.28
Time taken with sort(): 0.0112739 seconds Time taken with asort(): 0.0081391 seconds
Output for 5.3.27
Time taken with sort(): 0.0140319 seconds Time taken with asort(): 0.0095050 seconds
Output for 5.3.26
Time taken with sort(): 0.0114350 seconds Time taken with asort(): 0.0080330 seconds
Output for 5.3.25
Time taken with sort(): 0.0116658 seconds Time taken with asort(): 0.0079529 seconds
Output for 5.3.24
Time taken with sort(): 0.0119369 seconds Time taken with asort(): 0.0080590 seconds
Output for 5.3.23
Time taken with sort(): 0.0163748 seconds Time taken with asort(): 0.0094330 seconds
Output for 5.3.22
Time taken with sort(): 0.0113809 seconds Time taken with asort(): 0.0076029 seconds
Output for 5.3.21
Time taken with sort(): 0.0108829 seconds Time taken with asort(): 0.0074520 seconds
Output for 5.3.20
Time taken with sort(): 0.0120039 seconds Time taken with asort(): 0.0075221 seconds
Output for 5.3.19
Time taken with sort(): 0.0120759 seconds Time taken with asort(): 0.0077541 seconds
Output for 5.3.18
Time taken with sort(): 0.0130990 seconds Time taken with asort(): 0.0096331 seconds
Output for 5.3.17
Time taken with sort(): 0.0115621 seconds Time taken with asort(): 0.0078859 seconds
Output for 5.3.16
Time taken with sort(): 0.0119960 seconds Time taken with asort(): 0.0078678 seconds
Output for 5.3.15
Time taken with sort(): 0.0143790 seconds Time taken with asort(): 0.0100021 seconds
Output for 5.3.14
Time taken with sort(): 0.0116301 seconds Time taken with asort(): 0.0080030 seconds
Output for 5.3.13
Time taken with sort(): 0.0121908 seconds Time taken with asort(): 0.0085769 seconds
Output for 5.3.12
Time taken with sort(): 0.0130379 seconds Time taken with asort(): 0.0081160 seconds
Output for 5.3.11
Time taken with sort(): 0.0136931 seconds Time taken with asort(): 0.0079501 seconds
Output for 5.3.10
Time taken with sort(): 0.0132182 seconds Time taken with asort(): 0.0080528 seconds
Output for 5.3.9
Time taken with sort(): 0.0139179 seconds Time taken with asort(): 0.0080180 seconds
Output for 5.3.8
Time taken with sort(): 0.0129199 seconds Time taken with asort(): 0.0080581 seconds
Output for 5.3.7
Time taken with sort(): 0.0148461 seconds Time taken with asort(): 0.0080791 seconds
Output for 5.3.6
Time taken with sort(): 0.0122509 seconds Time taken with asort(): 0.0082159 seconds
Output for 5.3.5
Time taken with sort(): 0.0125170 seconds Time taken with asort(): 0.0079420 seconds
Output for 5.3.4
Time taken with sort(): 0.0149040 seconds Time taken with asort(): 0.0076900 seconds
Output for 5.3.3
Time taken with sort(): 0.0128281 seconds Time taken with asort(): 0.0080020 seconds
Output for 5.3.2
Time taken with sort(): 0.0155311 seconds Time taken with asort(): 0.0079780 seconds
Output for 5.3.1
Time taken with sort(): 0.0108931 seconds Time taken with asort(): 0.0077510 seconds
Output for 5.3.0
Time taken with sort(): 0.0111721 seconds Time taken with asort(): 0.0076230 seconds
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.2.17
Parse error: syntax error, unexpected T_CONST in /in/s9s5X 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/s9s5X on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/s9s5X on line 3
Process exited with code 255.