3v4l.org

run code in 300+ PHP versions simultaneously
<?php $myarray = [ [0, 70, 19, 0], [0, 24, 14], // note missing 4th element [0, 15, 11, 0], [0, 15, 27, 0] ]; for ($i = sizeof($myarray)-2; $i>=0; --$i) { // start from 2nd last subarray, and move toward the start $max = max(sizeof($myarray[$i]), sizeof($myarray[$i+1])); // make sure all elements are accounted for for($k = 0; $k < $max; ++$k) { // iterate and perform subtractions / declarations $myarray[$i][$k] = (isset($myarray[$i][$k]) ? $myarray[$i][$k] : 0) - (isset($myarray[$i+1][$k]) ? $myarray[$i+1][$k] : 0); // declare/overwrite new values as encountered } } var_export($myarray);

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.70.0070.01016.75
8.3.60.0110.01118.56
8.3.50.0040.01117.99
8.3.40.0070.00718.89
8.3.30.0040.01118.70
8.3.20.0070.00021.89
8.3.10.0060.00321.90
8.3.00.0210.00021.67
8.2.190.0040.01116.58
8.2.180.0070.01118.16
8.2.170.0140.00719.13
8.2.160.0040.01122.96
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0000.00821.11
8.2.120.0040.00426.35
8.2.110.0060.00322.15
8.2.100.0000.01219.45
8.2.90.0050.00317.63
8.2.80.0100.00418.61
8.2.70.0040.00417.91
8.2.60.0040.00417.50
8.2.50.0040.00417.55
8.2.40.0100.00517.62
8.2.30.0080.00021.04
8.2.20.0070.00018.07
8.2.10.0050.00318.28
8.2.00.0000.00819.22
8.1.280.0100.00725.92
8.1.270.0040.00421.77
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00720.41
8.1.230.0080.00417.76
8.1.220.0030.00517.79
8.1.210.0000.00818.77
8.1.200.0000.00817.35
8.1.190.0080.00017.23
8.1.180.0000.00718.10
8.1.170.0050.00317.62
8.1.160.0080.00018.98
8.1.150.0040.00418.97
8.1.140.0040.00419.45
8.1.130.0030.00319.11
8.1.120.0070.00317.39
8.1.110.0070.00017.51
8.1.100.0000.00917.42
8.1.90.0040.00417.39
8.1.80.0000.00817.38
8.1.70.0040.00417.51
8.1.60.0080.00417.67
8.1.50.0080.00017.44
8.1.40.0040.00417.54
8.1.30.0040.00417.65
8.1.20.0040.00417.71
8.1.10.0000.00817.52
8.1.00.0040.00417.42
8.0.300.0070.00018.77
8.0.290.0060.00316.63
8.0.280.0000.00718.41
8.0.270.0070.00016.84
8.0.260.0000.00617.14
8.0.250.0080.00016.80
8.0.240.0000.00716.95
8.0.230.0040.00416.94
8.0.220.0000.00716.77
8.0.210.0030.00316.77
8.0.200.0030.00316.87
8.0.190.0050.00216.96
8.0.180.0030.00316.85
8.0.170.0060.00316.92
8.0.160.0040.00417.02
8.0.150.0000.00816.75
8.0.140.0000.00816.95
8.0.130.0000.00613.39
8.0.120.0050.00316.89
8.0.110.0030.00516.82
8.0.100.0070.00016.91
8.0.90.0040.00416.89
8.0.80.0170.00716.81
8.0.70.0000.00716.78
8.0.60.0020.00516.71
8.0.50.0050.00316.80
8.0.30.0080.01017.11
8.0.20.0110.00917.40
8.0.10.0000.00716.90
8.0.00.0080.01316.66
7.4.330.0020.00215.55
7.4.320.0030.00316.46
7.4.300.0030.00316.68
7.4.290.0030.00316.68
7.4.280.0000.00816.52
7.4.270.0070.00016.64
7.4.260.0070.00016.57
7.4.250.0000.00716.61
7.4.240.0000.00716.69
7.4.230.0030.00316.46
7.4.220.0000.00816.64
7.4.210.0060.00916.59
7.4.200.0020.00516.61
7.4.160.0080.00916.59
7.4.140.0090.00917.86
7.4.130.0130.00716.50
7.4.120.0100.00916.56
7.4.110.0170.00016.62
7.4.100.0060.01016.52
7.4.90.0140.00316.50
7.4.80.0150.00819.39
7.4.70.0070.01016.37
7.4.60.0090.00616.55
7.4.50.0060.00916.61
7.4.40.0180.00616.48
7.4.00.0030.00614.87
7.3.330.0000.00513.24
7.3.320.0030.00313.08
7.3.310.0000.00716.18
7.3.300.0030.00316.34
7.3.290.0000.00716.22
7.3.280.0040.01316.29
7.3.260.0100.00716.52
7.3.240.0100.00916.40
7.3.230.0150.00316.47
7.3.210.0070.01016.58
7.3.200.0090.01416.55
7.3.190.0160.00616.43
7.3.180.0040.01216.38
7.3.170.0060.01116.70
7.3.160.0060.01016.64
7.3.120.0100.00714.73
7.3.110.0070.01014.73
7.3.100.0030.01314.82
7.3.90.0090.00914.80
7.3.80.0000.00815.15
7.3.70.0060.00614.90
7.3.60.0090.00414.86
7.3.50.0000.01414.78
7.3.40.0070.00714.85
7.3.30.0090.00014.86
7.3.20.0060.00916.61
7.3.10.0080.00416.41
7.3.00.0100.00716.56
7.2.330.0060.01516.87
7.2.320.0150.00916.77
7.2.310.0090.00916.45
7.2.300.0110.00816.78
7.2.290.0000.01816.79
7.2.240.0100.00615.34
7.2.230.0060.00615.07
7.2.220.0080.00414.96
7.2.210.0050.00515.34
7.2.200.0000.01215.24
7.2.190.0030.00615.25
7.2.180.0070.00715.08
7.2.170.0070.00715.28
7.2.160.0000.01215.14
7.2.150.0000.01117.07
7.2.140.0090.00617.09
7.2.130.0000.00916.88
7.2.120.0070.00716.78
7.2.110.0080.00617.02
7.2.100.0040.01116.80
7.2.90.0110.00716.99
7.2.80.0070.01017.04
7.2.70.0060.00616.97
7.2.60.0110.00716.88
7.2.50.0040.01016.93
7.2.40.0550.00917.36
7.2.30.0700.00717.32
7.2.20.0700.01217.49
7.2.10.0590.01117.42
7.2.00.0440.00917.40
7.1.330.0100.00015.93
7.1.320.0040.00815.71
7.1.310.0060.00615.85
7.1.300.0000.01216.01
7.1.290.0060.01015.80
7.1.280.0000.00815.79
7.1.270.0030.01015.81
7.1.260.0060.01215.76
7.1.250.0030.00715.82
7.1.200.0070.00715.88
7.1.160.1310.00616.67
7.1.150.1090.00716.85
7.1.140.0980.00916.73
7.1.130.0890.00816.56
7.1.120.0730.00716.48
7.1.110.0900.00716.49
7.1.100.0990.00716.36
7.1.90.0970.00616.21
7.1.80.0790.00616.20
7.1.70.0620.01015.30
7.1.60.1530.01033.07
7.1.50.1020.00933.19
7.1.40.1140.01032.68
7.1.30.0890.01532.79
7.1.20.1140.01432.82
7.1.10.0790.00914.66
7.1.00.1300.00915.05

preferences:
40.46 ms | 401 KiB | 5 Q