3v4l.org

run code in 300+ PHP versions simultaneously
<?php function ascending_array($array){ if (!is_array($array)){ $array = explode(",", $array); } $new = array(); $flag = true; iter: $array = array_values($array); // recount array values with new offsets (isset($min["max"])) ? $min["value"] = $min["max"] : $min["value"] = $array[0]; $min["offset"] = 0; for ($i=0;$i<count($array);$i++){ if ($array[$i] < $min["value"]){ // redefine min values each time if statement executed $min["value"] = $array[$i]; $min["offset"] = $i; } if ($flag){ // execute only first time if ($array[$i] > $min["value"]){ // define max value from array $min["max"] = $array[$i]; } $flag = false; } if ($i === (count($array)-1)){ // last array element array_push($new,$min["value"]); unset($array[$min["offset"]]); } } if (count($array)!=0){ goto iter; } print_r($new); } $arr = array(50,25,98,45); print_r(ascending_array($arr)); // 25 45 50 98

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.64
8.3.30.0070.00719.26
8.3.20.0040.00420.34
8.3.10.0040.00422.10
8.3.00.0040.00422.58
8.2.170.0170.00322.96
8.2.160.0070.00719.34
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.38
8.2.110.0000.01121.03
8.2.100.0060.00618.09
8.2.90.0030.00519.19
8.2.80.0050.00317.97
8.2.70.0040.00417.50
8.2.60.0060.00318.05
8.2.50.0000.00818.10
8.2.40.0080.00020.07
8.2.30.0000.00818.19
8.2.20.0040.00417.66
8.2.10.0040.00417.77
8.2.00.0030.00717.66
8.1.270.0050.00322.07
8.1.260.0070.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00922.49
8.1.230.0080.00320.32
8.1.220.0030.00517.79
8.1.210.0030.00518.77
8.1.200.0080.00017.38
8.1.190.0050.00517.36
8.1.180.0000.00818.10
8.1.170.0000.00818.54
8.1.160.0040.00422.20
8.1.150.0040.00418.66
8.1.140.0000.00717.38
8.1.130.0000.00717.71
8.1.120.0000.00717.37
8.1.110.0040.00417.44
8.1.100.0080.00017.36
8.1.90.0000.00717.30
8.1.80.0030.00317.46
8.1.70.0040.00417.43
8.1.60.0060.00317.49
8.1.50.0040.00417.53
8.1.40.0000.00717.54
8.1.30.0030.00617.56
8.1.20.0040.00417.59
8.1.10.0070.00017.62
8.1.00.0040.00417.38
8.0.300.0040.00418.77
8.0.290.0030.00616.75
8.0.280.0030.00318.36
8.0.270.0030.00317.26
8.0.260.0000.00816.71
8.0.250.0040.00416.85
8.0.240.0000.00716.94
8.0.230.0030.00317.00
8.0.220.0030.00316.89
8.0.210.0000.00716.89
8.0.200.0050.00316.88
8.0.190.0040.00417.01
8.0.180.0000.00716.94
8.0.170.0040.00416.92
8.0.160.0040.00416.88
8.0.150.0050.00216.85
8.0.140.0000.00716.82
8.0.130.0030.00313.29
8.0.120.0030.00516.74
8.0.110.0080.00016.78
8.0.100.0030.00416.83
8.0.90.0050.00316.85
8.0.80.0030.01016.85
8.0.70.0070.00016.97
8.0.60.0000.00716.89
8.0.50.0040.00416.81
8.0.30.0160.00517.10
8.0.20.0130.01017.40
8.0.10.0040.00417.06
8.0.00.0110.00616.62
7.4.330.0050.00015.00
7.4.320.0000.00716.45
7.4.300.0060.00016.61
7.4.290.0070.00016.41
7.4.280.0030.00316.49
7.4.270.0030.00316.53
7.4.260.0000.00816.39
7.4.250.0050.00316.58
7.4.240.0040.00416.55
7.4.230.0030.00316.51
7.4.220.0140.00716.50
7.4.210.0060.01016.57
7.4.200.0040.00216.50
7.4.190.0050.00316.70
7.4.160.0100.00616.31
7.4.150.0100.00717.40
7.4.140.0110.00617.86
7.4.130.0080.01116.45
7.4.120.0100.00716.48
7.4.110.0140.00316.73
7.4.100.0140.00316.67
7.4.90.0090.00916.50
7.4.80.0090.00919.39
7.4.70.0170.00016.29
7.4.60.0120.00316.48
7.4.50.0040.00416.50
7.4.40.0100.00622.77
7.4.30.0170.00016.58
7.4.10.0070.01015.03
7.4.00.0050.01214.88
7.3.330.0020.00213.17
7.3.320.0050.00013.19
7.3.310.0070.00016.37
7.3.300.0030.00316.27
7.3.290.0070.00716.31
7.3.280.0080.00916.38
7.3.270.0100.00617.40
7.3.260.0130.00316.47
7.3.250.0120.00616.66
7.3.240.0090.01316.49
7.3.230.0070.01416.69
7.3.210.0030.01316.30
7.3.200.0090.01519.39
7.3.190.0080.00816.38
7.3.180.0130.00716.45
7.3.170.0150.00616.30
7.3.160.0080.00816.50
7.3.130.0070.01114.60
7.3.120.0080.00714.98
7.3.110.0080.01014.79
7.3.100.0060.00814.93
7.3.90.0060.00814.89
7.3.80.0060.00514.95
7.3.70.0030.01114.75
7.3.60.0050.00814.86
7.3.50.0090.00414.75
7.3.40.0060.00614.76
7.3.30.0060.00614.81
7.3.20.0060.00716.70
7.3.10.0030.01216.58
7.3.00.0050.00716.61
7.2.330.0120.00616.75
7.2.320.0070.01116.55
7.2.310.0080.01516.60
7.2.300.0110.00516.73
7.2.290.0100.00616.59
7.2.260.0050.01015.00
7.2.250.0090.00614.94
7.2.240.0050.01115.22
7.2.230.0050.01014.99
7.2.220.0040.01115.01
7.2.210.0050.00914.99
7.2.200.0060.00814.96
7.2.190.0070.00815.03
7.2.180.0070.00814.94
7.2.170.0060.00815.03
7.2.160.0060.00914.97
7.2.150.0070.00716.96
7.2.140.0060.00816.87
7.2.130.0040.01016.84
7.2.120.0050.00716.96
7.2.110.0020.01117.00
7.2.100.0030.01217.00
7.2.90.0050.00916.95
7.2.80.0050.01016.95
7.2.70.0030.00916.96
7.2.60.0060.00716.99
7.2.50.0050.00916.98
7.2.40.0070.00816.89
7.2.30.0080.00616.92
7.2.20.0070.00816.91
7.2.10.0080.00716.91
7.2.00.0080.00616.92
7.1.330.0060.00915.91
7.1.320.0060.00715.82
7.1.310.0050.00815.83
7.1.300.0040.01015.81
7.1.290.0050.00515.81
7.1.280.0070.00715.78
7.1.270.0070.00615.77
7.1.260.0050.01115.85
7.1.250.0070.00515.83
7.1.240.0080.00715.78
7.1.230.0020.01015.84
7.1.220.0040.00715.82
7.1.210.0070.00615.83
7.1.200.0080.00515.81
7.1.190.0050.00615.84
7.1.180.0070.00715.70
7.1.170.0070.00615.83
7.1.160.0040.00815.85
7.1.150.0050.01015.79
7.1.140.0050.00815.82
7.1.130.0050.00915.68
7.1.120.0060.00515.79
7.1.110.0060.00515.80
7.1.100.0060.00815.85
7.1.90.0040.00915.78
7.1.80.0060.00715.81
7.1.70.0050.00916.12
7.1.60.0070.00916.61
7.1.50.0050.01016.08
7.1.40.0040.00915.81
7.1.30.0050.00815.85
7.1.20.0060.00815.77
7.1.10.0050.00615.79
7.1.00.0050.01117.08
7.0.330.0040.00915.33
7.0.320.0030.01015.42
7.0.310.0050.00515.38
7.0.300.0060.00615.36
7.0.290.0040.00915.44
7.0.280.0080.00415.32
7.0.270.0080.00815.36
7.0.260.0090.00415.44
7.0.250.0040.00715.45
7.0.240.0040.00815.42
7.0.230.0080.00415.46
7.0.220.0070.00915.36
7.0.210.0050.00415.37
7.0.200.0030.00915.68
7.0.190.0050.00815.39
7.0.180.0060.00615.41
7.0.170.0050.00815.35
7.0.160.0060.00615.40
7.0.150.0040.00715.42
7.0.140.0020.02416.84
7.0.130.0080.00515.39
7.0.120.0030.00915.26
7.0.110.0040.02216.37
7.0.100.0040.02316.27
7.0.90.0060.02216.32
7.0.80.0080.02116.34
7.0.70.0050.01716.29
7.0.60.0050.01516.32
7.0.50.0070.02216.45
7.0.40.0100.01214.71
7.0.30.0060.01914.75
7.0.20.0060.02314.85
7.0.10.0070.02214.74
7.0.00.0080.02014.81
5.6.400.0030.00814.48
5.6.390.0060.00514.65
5.6.380.0060.00514.43
5.6.370.0020.00914.52
5.6.360.0040.00814.51
5.6.350.0010.01014.55
5.6.340.0030.00814.23
5.6.330.0070.00614.55
5.6.320.0050.00814.60
5.6.310.0020.01014.57
5.6.300.0030.00714.46
5.6.290.0040.00914.47
5.6.280.0040.02015.88
5.6.270.0050.00614.48
5.6.260.0050.01515.73
5.6.250.0070.02115.66
5.6.240.0080.01915.63
5.6.230.0080.02015.64
5.6.220.0050.02315.72
5.6.210.0050.02215.68
5.6.200.0060.01915.73
5.6.190.0060.02215.83
5.6.180.0050.02315.67
5.6.170.0060.02115.75
5.6.160.0090.02215.81
5.6.150.0090.02115.84
5.6.140.0080.02215.81
5.6.130.0070.02115.89
5.6.120.0070.02015.80
5.6.110.0050.02315.68
5.6.100.0070.02215.74
5.6.90.0050.02415.82
5.6.80.0040.02515.57
5.6.70.0070.01715.62
5.6.60.0060.01815.50
5.6.50.0070.02115.62
5.6.40.0050.02315.53
5.6.30.0070.01515.61
5.6.20.0060.02315.57
5.6.10.0050.01915.66
5.6.00.0060.02315.48
5.5.380.0030.01815.72
5.5.370.0080.01315.74
5.5.360.0070.01815.65
5.5.350.0060.02015.77
5.5.340.0060.02015.71
5.5.330.0070.01915.75
5.5.320.0050.02215.84
5.5.310.0090.01915.70
5.5.300.0050.02415.70
5.5.290.0050.02015.64
5.5.280.0050.01715.51
5.5.270.0050.01915.61
5.5.260.0040.02115.79
5.5.250.0080.02015.49
5.5.240.0070.01915.49
5.5.230.0070.01515.46
5.5.220.0050.02115.52
5.5.210.0060.01915.49
5.5.200.0070.01715.44
5.5.190.0050.02115.65
5.5.180.0040.01915.35
5.5.170.0070.00614.16
5.5.160.0080.01215.60
5.5.150.0040.01615.61
5.5.140.0070.02115.57
5.5.130.0100.02115.46
5.5.120.0060.02015.50
5.5.110.0110.01615.54
5.5.100.0070.02115.48
5.5.90.0050.02315.57
5.5.80.0050.02115.50
5.5.70.0080.01315.43
5.5.60.0050.01515.47
5.5.50.0060.01915.45
5.5.40.0030.02415.65
5.5.30.0070.02015.49
5.5.20.0080.01515.45
5.5.10.0040.02315.48
5.5.00.0090.02015.35
5.4.450.0030.02313.65
5.4.440.0060.01813.63
5.4.430.0050.01513.57
5.4.420.0050.01513.63
5.4.410.0060.01913.67
5.4.400.0040.02013.51
5.4.390.0060.01113.50
5.4.380.0030.02013.55
5.4.370.0070.01213.62
5.4.360.0070.01413.49
5.4.350.0060.01513.52
5.4.340.0050.02113.70
5.4.330.0050.00512.15
5.4.320.0070.01813.68
5.4.310.0040.01813.52
5.4.300.0070.01613.66
5.4.290.0060.01513.56
5.4.280.0040.02113.50
5.4.270.0040.01813.53
5.4.260.0050.01313.45
5.4.250.0020.02213.48
5.4.240.0070.01813.54
5.4.230.0030.01913.49
5.4.220.0060.02113.57
5.4.210.0060.01913.62
5.4.200.0030.01413.58
5.4.190.0030.02213.52
5.4.180.0080.01413.50
5.4.170.0040.01413.50
5.4.160.0020.02213.60
5.4.150.0060.01913.58
5.4.140.0040.01712.98
5.4.130.0030.01513.05
5.4.120.0040.01913.02
5.4.110.0050.01913.11
5.4.100.0050.01812.98
5.4.90.0050.01913.06
5.4.80.0030.01813.05
5.4.70.0050.01513.14
5.4.60.0070.01713.03
5.4.50.0040.02013.12
5.4.40.0050.01813.08
5.4.30.0050.01913.08
5.4.20.0050.01413.03
5.4.10.0060.01913.03
5.4.00.0050.01412.93
5.3.290.0080.01812.51
5.3.280.0040.01912.41
5.3.270.0020.02212.44
5.3.260.0060.01712.49
5.3.250.0060.01612.38
5.3.240.0050.01912.46
5.3.230.0020.01412.43
5.3.220.0030.01812.47
5.3.210.0040.01512.36
5.3.200.0020.02212.39
5.3.190.0010.01412.38
5.3.180.0060.01612.54
5.3.170.0050.01112.47
5.3.160.0050.01212.44
5.3.150.0040.01412.53
5.3.140.0060.01912.45
5.3.130.0060.01112.42
5.3.120.0040.01212.53
5.3.110.0060.01912.46
5.3.100.0050.01912.39
5.3.90.0050.01912.39
5.3.80.0060.01812.30
5.3.70.0050.01512.31
5.3.60.0040.01912.38
5.3.50.0050.01912.32
5.3.40.0040.02012.30
5.3.30.0070.01812.32
5.3.20.0050.02012.19
5.3.10.0030.01712.17
5.3.00.0030.01912.18
5.2.170.0030.03311.86
5.2.160.0000.06711.86
5.2.150.0000.06711.86
5.2.140.0070.06011.86
5.2.130.0000.03311.86
5.2.120.0000.03311.86
5.2.110.0000.04011.86
5.2.100.0030.06711.86
5.2.90.0070.04711.86
5.2.80.0070.06311.86
5.2.70.0030.05311.86
5.2.60.0070.05311.86
5.2.50.0030.04711.86
5.2.40.0030.06311.86
5.2.30.0100.05311.86
5.2.20.0070.05711.86
5.2.10.0070.03011.86
5.2.00.0030.05311.86
5.1.60.0000.02711.86
5.1.50.0070.04311.86
5.1.40.0030.05011.86
5.1.30.0030.03011.86
5.1.20.0030.05311.86
5.1.10.0000.05311.86
5.1.00.0000.04311.86
5.0.50.0100.02711.86
5.0.40.0070.02311.86
5.0.30.0100.05311.86
5.0.20.0030.04311.86
5.0.10.0070.03011.86
5.0.00.0030.06011.86
4.4.90.0000.03711.86
4.4.80.0000.02711.86
4.4.70.0070.03011.86
4.4.60.0070.02011.86
4.4.50.0000.03311.86
4.4.40.0030.02311.86
4.4.30.0000.03311.86
4.4.20.0070.03011.86
4.4.10.0030.02711.86
4.4.00.0030.03711.86
4.3.110.0000.02011.86
4.3.100.0000.02711.86
4.3.90.0100.02011.86
4.3.80.0000.04311.86
4.3.70.0030.03311.86
4.3.60.0030.03311.86
4.3.50.0070.03011.86
4.3.40.0000.04711.86
4.3.30.0030.03011.86
4.3.20.0000.01711.86
4.3.10.0030.02711.86
4.3.00.0000.03311.86

preferences:
42.98 ms | 400 KiB | 5 Q