3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array=array('2','4','8','5','1','7','6','9','10','3'); echo "Unsorted array is: "; //show the unsorted array print_r($array); //j is 0, j is less than 10, add 1 to j if this is true. for($j = 0; $j < count($array); $j ++) { //i is 0, i is less than 10 - 1 makes it 9(?), add 1 to i if this is true for($i = 0; $i < count($array)-1; $i ++){ // if($array[$i] > $array[$i+1]) { $temp = $array[$i+1]; $array[$i+1]=$array[$i]; $array[$i]=$temp; } } } echo "Sorted Array is: "; print_r($array); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.40.0090.00618.70
8.3.30.0070.00719.13
8.3.20.0080.00019.93
8.3.10.0030.00521.92
8.3.00.0040.00422.57
8.2.170.0090.00922.96
8.2.160.0070.00720.89
8.2.150.0070.00024.18
8.2.140.0070.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.35
8.2.110.0090.00020.52
8.2.100.0120.00017.84
8.2.90.0040.00419.39
8.2.80.0000.00817.97
8.2.70.0040.00417.50
8.2.60.0030.00618.05
8.2.50.0040.00418.07
8.2.40.0080.00020.08
8.2.30.0040.00418.19
8.2.20.0030.00517.71
8.2.10.0040.00419.47
8.2.00.0000.00717.74
8.1.270.0040.00422.02
8.1.260.0070.00026.35
8.1.250.0000.00728.09
8.1.240.0030.00623.89
8.1.230.0040.00718.79
8.1.220.0080.00017.78
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0060.00318.62
8.1.160.0040.00418.81
8.1.150.0040.00418.69
8.1.140.0000.00717.37
8.1.130.0050.00217.74
8.1.120.0000.00717.54
8.1.110.0040.00417.39
8.1.100.0020.00517.35
8.1.90.0000.00717.39
8.1.80.0070.00017.36
8.1.70.0070.00017.30
8.1.60.0030.00917.59
8.1.50.0040.00417.52
8.1.40.0000.00817.44
8.1.30.0000.00817.47
8.1.20.0000.00817.54
8.1.10.0000.00717.50
8.1.00.0000.00717.36
8.0.300.0000.00818.77
8.0.290.0020.00516.63
8.0.280.0030.00318.36
8.0.270.0040.00417.25
8.0.260.0030.00316.73
8.0.250.0000.00716.95
8.0.240.0000.00716.86
8.0.230.0000.00716.94
8.0.220.0000.00716.96
8.0.210.0000.00816.80
8.0.200.0030.00316.88
8.0.190.0080.00016.99
8.0.180.0000.00716.79
8.0.170.0040.00416.78
8.0.160.0050.00316.88
8.0.150.0070.00016.75
8.0.140.0050.00316.82
8.0.130.0030.00313.25
8.0.120.0050.00316.86
8.0.110.0040.00416.80
8.0.100.0050.00317.00
8.0.90.0050.00216.72
8.0.80.0100.00716.95
8.0.70.0040.00416.90
8.0.60.0000.00716.88
8.0.50.0040.00416.79
8.0.30.0130.01317.02
8.0.20.0170.00417.40
8.0.10.0040.00416.84
8.0.00.0090.00916.64
7.4.330.0060.00015.14
7.4.320.0030.00316.58
7.4.300.0000.00616.61
7.4.290.0070.00016.50
7.4.280.0000.00716.41
7.4.270.0000.00716.43
7.4.260.0030.00316.46
7.4.250.0060.00316.46
7.4.240.0040.00416.56
7.4.230.0070.00016.50
7.4.220.0100.01016.55
7.4.210.0060.01016.53
7.4.200.0000.00716.54
7.4.190.0000.00716.46
7.4.160.0030.01316.73
7.4.150.0060.01517.40
7.4.140.0130.00717.86
7.4.130.0130.00916.63
7.4.120.0080.00816.55
7.4.110.0030.01316.52
7.4.100.0130.01016.52
7.4.90.0170.00016.33
7.4.80.0090.00919.39
7.4.70.0120.00916.54
7.4.60.0160.00516.41
7.4.50.0050.00016.53
7.4.40.0070.01022.77
7.4.30.0110.00416.66
7.4.10.0060.01314.84
7.4.00.0050.01315.04
7.3.330.0020.00513.24
7.3.320.0000.00513.29
7.3.310.0080.00016.39
7.3.300.0030.00316.16
7.3.290.0030.01016.29
7.3.280.0040.01316.36
7.3.270.0110.00617.40
7.3.260.0110.00516.39
7.3.250.0090.01116.48
7.3.240.0100.00716.36
7.3.230.0120.00616.39
7.3.210.0100.00716.58
7.3.200.0090.01219.39
7.3.190.0090.01216.38
7.3.180.0070.01416.52
7.3.170.0070.01416.45
7.3.160.0070.01016.48
7.3.130.0090.00915.07
7.3.120.0020.01314.88
7.3.110.0060.01214.80
7.3.100.0060.00615.00
7.3.90.0130.00315.02
7.3.80.0030.00714.94
7.3.70.0060.00614.59
7.3.60.0000.01314.55
7.3.50.0120.00314.54
7.3.40.0110.00314.75
7.3.30.0000.01314.88
7.3.20.0030.00616.55
7.3.10.0070.00716.70
7.3.00.0070.01116.61
7.2.330.0110.00516.71
7.2.320.0110.02016.42
7.2.310.0150.00716.83
7.2.300.0110.01116.78
7.2.290.0140.00316.51
7.2.260.0000.02115.07
7.2.250.0030.01015.25
7.2.240.0060.00915.15
7.2.230.0060.01015.29
7.2.220.0070.00315.22
7.2.210.0000.01415.10
7.2.200.0090.00015.08
7.2.190.0040.00915.00
7.2.180.0000.00915.14
7.2.170.0110.00015.02
7.2.160.0060.00915.02
7.2.150.0060.00316.69
7.2.140.0170.00017.12
7.2.130.0050.01016.86
7.2.120.0090.00816.88
7.2.110.0030.01216.79
7.2.100.0100.01316.87
7.2.90.0060.01116.87
7.2.80.0110.00616.92
7.2.70.0030.01317.03
7.2.60.0060.00716.80
7.2.50.0090.00716.99
7.2.40.0080.00916.85
7.2.30.0070.00716.75
7.2.20.0080.00816.79
7.2.10.0080.00616.87
7.2.00.0050.01217.71
7.1.330.0110.00315.86
7.1.320.0040.01215.62
7.1.310.0060.00616.00
7.1.300.0040.00415.89
7.1.290.0040.01115.86
7.1.280.0120.00015.81
7.1.270.0070.00715.59
7.1.260.0070.01015.88
7.1.250.0090.00815.75
7.1.240.0080.00715.68
7.1.230.0050.01115.57
7.1.220.0090.00815.81
7.1.210.0110.00515.76
7.1.200.0100.00615.73
7.1.190.0120.00215.85
7.1.180.0100.00215.68
7.1.170.0090.00515.75
7.1.160.0100.00315.64
7.1.150.0060.00715.61
7.1.140.0050.00815.85
7.1.130.0030.00915.68
7.1.120.0050.00915.81
7.1.110.0050.00915.82
7.1.100.0090.00716.01
7.1.90.0090.00615.95
7.1.80.0030.01115.69
7.1.70.0040.00916.24
7.1.60.0100.00917.07
7.1.50.0110.00616.01
7.1.40.0140.00515.71
7.1.30.0110.00315.87
7.1.20.0050.00915.86
7.1.10.0040.01015.90
7.1.00.0060.02917.97
7.0.330.0060.01015.38
7.0.320.0110.00415.43
7.0.310.0080.00815.21
7.0.300.0110.00615.23
7.0.290.0070.00715.35
7.0.280.0020.00915.23
7.0.270.0130.00015.59
7.0.260.0110.00515.35
7.0.250.0030.01215.17
7.0.240.0060.00615.38
7.0.230.0080.00615.26
7.0.220.0020.01015.31
7.0.210.0040.01315.26
7.0.200.0160.00515.12
7.0.190.0090.00515.45
7.0.180.0080.00815.24
7.0.170.0070.00715.49
7.0.160.0050.00715.25
7.0.150.0090.00715.22
7.0.140.0060.03017.64
7.0.130.0090.00315.20
7.0.120.0110.00615.43
7.0.110.0100.00515.44
7.0.100.0090.00515.33
7.0.90.0060.00915.31
7.0.80.0040.00915.36
7.0.70.0080.00915.49
7.0.60.0070.02616.81
7.0.50.0080.02716.20
7.0.40.0050.03315.50
7.0.30.0110.03415.57
7.0.20.0100.01915.74
7.0.10.0090.03115.68
7.0.00.0070.03115.68
5.6.400.0100.00614.13
5.6.390.0000.01314.36
5.6.380.0080.01214.55
5.6.370.0100.00714.47
5.6.360.0060.00814.52
5.6.350.0040.00914.50
5.6.340.0060.00914.70
5.6.330.0000.01314.67
5.6.320.0060.00914.82
5.6.310.0070.01014.60
5.6.300.0020.01414.38
5.6.290.0050.00914.38
5.6.280.0070.02716.73
5.6.270.0050.01014.20
5.6.260.0070.00814.35
5.6.250.0070.00614.22
5.6.240.0060.00914.55
5.6.230.0100.00414.52
5.6.220.0060.00514.47
5.6.210.0070.02416.48
5.6.200.0030.02415.55
5.6.190.0060.03416.29
5.6.180.1050.01416.29
5.6.170.0150.02816.44
5.6.160.0010.02016.49
5.6.150.0060.03015.71
5.6.140.0080.02715.59
5.6.130.0020.02715.77
5.6.120.0100.01616.72
5.6.110.0040.03716.64
5.6.100.0100.01516.64
5.6.90.0090.02916.56
5.6.80.0070.01716.46
5.6.70.1310.01816.40
5.6.60.0050.01114.48
5.6.50.0030.01214.50
5.6.40.0100.00514.39
5.6.30.0040.00814.32
5.6.20.0070.00714.52
5.6.10.0050.00814.19
5.6.00.0070.00914.27
5.5.380.0060.00312.88
5.5.370.0080.00312.75
5.5.360.0080.00713.02
5.5.350.0120.02415.39
5.5.340.0090.01814.71
5.5.330.0040.01915.20
5.5.320.0910.01715.30
5.5.310.0100.02215.26
5.5.300.0020.03414.67
5.5.290.0090.01914.50
5.5.280.0090.01515.36
5.5.270.0010.03515.41
5.5.260.0070.02515.30
5.5.250.0090.02815.34
5.5.240.0100.03115.17
5.5.230.0080.00512.67
5.5.220.0030.00712.74
5.5.210.0000.01012.63
5.5.200.0060.00812.83
5.5.190.0070.00712.79
5.5.180.0040.00512.64
5.5.170.0070.00712.87
5.5.160.0030.00812.71
5.5.150.0000.01112.93
5.5.140.0050.00712.71
5.5.130.0040.00612.68
5.5.120.0040.00512.83
5.5.110.0050.00812.82
5.5.100.0090.00612.77
5.5.90.0050.00712.68
5.5.80.0050.00512.78
5.5.70.0080.00312.79
5.5.60.0040.00712.84
5.5.50.0040.00912.72
5.5.40.0060.00512.89
5.5.30.0070.00412.75
5.5.20.0060.00612.79
5.5.10.0020.00912.77
5.5.00.0030.00812.64
5.4.450.0240.02313.89
5.4.440.0160.02214.01
5.4.430.0060.02413.85
5.4.420.0080.02414.04
5.4.410.0070.02313.99
5.4.400.0030.02413.54
5.4.390.0080.02113.52
5.4.380.0150.01913.64
5.4.370.0150.01813.70
5.4.360.0090.02213.60
5.4.350.0170.02313.71
5.4.340.0180.02813.71
5.4.330.0040.00711.27
5.4.320.0050.01811.54
5.4.310.0050.02111.50
5.4.300.0070.01411.67
5.4.290.0040.01611.64
5.4.280.0040.01811.62
5.4.270.0090.02413.86
5.4.260.0090.02713.79
5.4.250.0060.02113.79
5.4.240.0110.01813.79
5.4.230.0090.02013.77
5.4.220.0070.02513.81
5.4.210.0080.02313.84
5.4.200.0040.02213.87
5.4.190.0070.03013.61
5.4.180.0040.02813.78
5.4.170.0040.02913.80
5.4.160.0110.02613.84
5.4.150.0030.02313.79
5.4.140.0080.02412.91
5.4.130.0120.02013.02
5.4.120.0060.02213.06
5.4.110.0060.02812.83
5.4.100.0070.02012.99
5.4.90.0070.01913.01
5.4.80.0050.02313.07
5.4.70.0090.02512.99
5.4.60.0070.01812.96
5.4.50.0040.02312.97
5.4.40.0100.02113.04
5.4.30.0080.02113.02
5.4.20.0040.02112.85
5.4.10.0100.02512.88
5.4.00.0110.02212.70
5.3.290.0050.01711.60
5.3.280.0050.02212.25
5.3.270.0070.02312.26
5.3.260.0050.02412.20
5.3.250.0080.01912.28
5.3.240.0080.02112.29
5.3.230.0060.02512.27
5.3.220.0050.02212.22
5.3.210.0050.02412.24
5.3.200.0090.02412.20
5.3.190.0070.02212.27
5.3.180.0070.02012.28
5.3.170.0090.01812.22
5.3.160.0080.02012.20
5.3.150.0020.02312.18
5.3.140.0080.02112.28
5.3.130.0120.02412.23
5.3.120.0110.01712.27
5.3.110.0000.03412.19
5.3.100.0090.01712.09
5.3.90.0040.02812.09
5.3.80.0040.02612.02
5.3.70.0060.02012.09
5.3.60.0060.02212.05
5.3.50.0040.02612.04
5.3.40.0070.02012.00
5.3.30.0070.02911.98
5.3.20.0030.02211.91
5.3.10.0080.01911.95
5.3.00.0070.02511.89
5.2.170.0020.02711.21
5.2.160.0080.02811.21
5.2.150.0080.02311.24
5.2.140.0070.02511.31
5.2.130.0090.02411.16
5.2.120.0050.03311.23
5.2.110.0040.02611.16
5.2.100.0070.02111.16
5.2.90.0050.02311.13
5.2.80.0090.01911.13
5.2.70.0050.02311.23
5.2.60.0070.02211.22
5.2.50.0110.01911.13
5.2.40.0130.01811.23
5.2.30.0070.02211.13
5.2.20.0100.02011.15
5.2.10.0140.01811.16
5.2.00.0070.02511.03
5.1.60.0080.01810.74
5.1.50.0080.01510.57
5.1.40.0000.02510.58
5.1.30.0050.02110.83
5.1.20.0050.02010.84
5.1.10.0040.02410.66
5.1.00.0050.02310.61
5.0.50.0050.0169.95
5.0.40.0080.0139.94
5.0.30.0080.0189.70
5.0.20.0030.0169.84
5.0.10.0030.0169.79
5.0.00.0030.0249.66
4.4.90.0070.0109.39
4.4.80.0040.0139.39
4.4.70.0030.0159.39
4.4.60.0020.0179.39
4.4.50.0020.0149.39
4.4.40.0070.0159.39
4.4.30.0040.0109.39
4.4.20.0030.0149.39
4.4.10.0030.0159.39
4.4.00.0050.0179.39
4.3.110.0000.0149.39
4.3.100.0030.0119.39
4.3.90.0020.0129.39
4.3.80.0020.0199.39
4.3.70.0030.0109.39
4.3.60.0050.0109.39
4.3.50.0030.0169.39
4.3.40.0030.0189.39
4.3.30.0000.0159.39
4.3.20.0000.0149.39
4.3.10.0050.0109.39
4.3.00.0050.0118.92

preferences:
61.07 ms | 400 KiB | 5 Q