3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array1 = [2, 3, 4, 6]; $array2 = [ ["id_sabor" => 1, "chocolate" => "N"], ["id_sabor" => 2, "chocolate" => "N"], ["id_sabor" => 3, "chocolate" => "S"], ["id_sabor" => 4, "chocolate" => "N"], ["id_sabor" => 5, "chocolate" => "S"], ["id_sabor" => 6, "chocolate" => "N"] ]; $array2 = array_reduce($array2, function($carry, $item) use ($array1){ if (in_array($item["id_sabor"], $array1)) { if ($item["chocolate"] === "S") { $item["costo_extra"] = 25; } $carry[] = $item; } return $carry; }); print_r($array2);

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.4.130.0120.00818.58
8.4.120.0140.00624.35
8.4.110.0080.00718.98
8.4.100.0080.00217.54
8.4.90.0150.00617.69
8.4.80.0070.00819.60
8.4.70.0040.00418.02
8.4.60.0140.00618.78
8.4.50.0140.00718.56
8.4.40.0050.00817.41
8.4.30.0100.01017.61
8.4.20.0090.00019.42
8.4.10.0000.00917.88
8.3.260.0150.00616.57
8.3.250.0120.00618.87
8.3.240.0120.00717.17
8.3.230.0130.00716.47
8.3.220.0130.00716.74
8.3.210.0120.00716.75
8.3.200.0030.00516.51
8.3.190.0050.00318.95
8.3.180.0140.00516.93
8.3.170.0110.00420.52
8.3.160.0070.01018.96
8.3.150.0070.01417.23
8.3.140.0070.00716.71
8.3.130.0030.00618.43
8.3.120.0090.00020.95
8.3.110.0060.00320.94
8.3.100.0040.00424.06
8.3.90.0080.00326.77
8.3.80.0050.00518.55
8.3.70.0110.00718.43
8.3.60.0120.00318.30
8.3.50.0080.00817.32
8.3.40.0110.00718.88
8.3.30.0040.01218.84
8.3.20.0000.00819.15
8.3.10.0040.00420.86
8.3.00.0030.00618.05
8.2.290.0130.00518.93
8.2.280.0100.00918.27
8.2.270.0110.00317.54
8.2.260.0080.00016.51
8.2.250.0040.00416.95
8.2.240.0080.00018.98
8.2.230.0080.00022.58
8.2.220.0060.00337.54
8.2.210.0070.01026.77
8.2.200.0000.00816.50
8.2.190.0040.01416.88
8.2.180.0080.00818.53
8.2.170.0120.00622.96
8.2.160.0120.00620.90
8.2.150.0070.00724.18
8.2.140.0080.00024.66
8.2.130.0050.00319.82
8.2.120.0050.00326.35
8.2.110.0000.01020.52
8.2.100.0070.00417.72
8.2.90.0050.00319.64
8.2.80.0050.00317.97
8.2.70.0040.00417.63
8.2.60.0080.00018.03
8.2.50.0050.00818.07
8.2.40.0000.00818.23
8.2.30.0030.00518.06
8.2.20.0040.00418.20
8.2.10.0000.00718.02
8.2.00.0030.00319.41
8.1.330.0100.00821.95
8.1.320.0050.00417.81
8.1.310.0040.01416.14
8.1.300.0030.00616.34
8.1.290.0040.00430.84
8.1.280.0150.00425.92
8.1.270.0000.00722.19
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0090.00020.97
8.1.230.0090.00322.66
8.1.220.0000.00817.79
8.1.210.0040.00418.90
8.1.200.0040.00417.36
8.1.190.0060.00317.23
8.1.180.0060.00318.10
8.1.170.0040.00418.56
8.1.160.0050.00218.89
8.1.150.0000.00718.95
8.1.140.0040.00417.61
8.1.130.0000.00818.99
8.1.120.0000.00717.50
8.1.110.0000.00717.40
8.1.100.0000.00817.40
8.1.90.0000.00717.36
8.1.80.0070.00317.30
8.1.70.0070.00417.48
8.1.60.0040.00417.63
8.1.50.0020.00517.60
8.1.40.0040.00417.55
8.1.30.0030.00617.71
8.1.20.0040.00417.63
8.1.10.0040.00417.47
8.1.00.0050.00317.44
8.0.300.0040.00420.06
8.0.290.0000.00816.63
8.0.280.0000.00718.36
8.0.270.0070.00017.13
8.0.260.0000.00818.96
8.0.250.0000.00716.88
8.0.240.0030.00316.86
8.0.230.0000.00716.99
8.0.220.0070.00016.86
8.0.210.0000.00716.89
8.0.200.0030.00316.96
8.0.190.0070.00017.00
8.0.180.0040.00416.93
8.0.170.0040.00416.94
8.0.160.0000.00816.85
8.0.150.0070.00016.79
8.0.140.0000.00716.77
8.0.130.0000.00613.31
8.0.120.0060.00316.87
8.0.110.0050.00216.89
8.0.100.0040.00416.84
8.0.90.0030.00616.77
8.0.80.0150.00516.94
8.0.70.0040.00416.70
8.0.60.0050.00217.01
8.0.50.0040.00416.93
8.0.30.0090.01017.07
8.0.20.0100.01217.40
8.0.10.0040.00417.05
8.0.00.0110.00716.78
7.4.330.0000.00615.55
7.4.320.0040.00416.60
7.4.300.0060.00016.50
7.4.290.0060.00316.51
7.4.280.0000.00716.59
7.4.270.0030.00316.51
7.4.260.0000.00716.45
7.4.250.0000.00716.53
7.4.240.0070.00016.49
7.4.230.0040.00416.40
7.4.220.0030.00616.48
7.4.210.0060.00816.57
7.4.200.0000.00716.40
7.4.160.0100.00616.45
7.4.140.0090.01117.86
7.4.130.0090.00916.53
7.4.120.0110.00816.59
7.4.110.0070.01016.34
7.4.100.0130.00316.55
7.4.90.0160.00616.54
7.4.80.0060.01219.39
7.4.70.0100.00716.57
7.4.60.0030.01316.63
7.4.50.0040.01116.44
7.4.40.0150.00916.61
7.4.10.0100.00715.03
7.4.00.0090.00814.81
7.3.330.0030.00213.43
7.3.320.0000.00813.29
7.3.310.0000.00716.32
7.3.300.0000.00716.27
7.3.290.0040.00416.25
7.3.280.0050.01116.43
7.3.260.0110.00816.49
7.3.240.0090.01216.40
7.3.230.0090.00816.34
7.3.210.0070.01416.45
7.3.200.0100.00716.62
7.3.190.0070.01016.38
7.3.180.0100.00616.38
7.3.170.0080.00816.68
7.3.160.0090.01216.28
7.3.130.0060.01314.89
7.3.120.0100.00714.97
7.3.110.0070.01114.92
7.3.100.0070.00814.80
7.3.90.0080.00814.95
7.3.80.0070.00614.98
7.3.70.0030.00814.73
7.3.60.0060.00414.70
7.3.50.0020.01014.84
7.3.40.0080.00714.86
7.3.30.0050.00614.94
7.3.20.0050.00916.69
7.3.10.0040.00716.66
7.3.00.0040.01016.75
7.2.330.0080.01116.79
7.2.320.0090.00916.67
7.2.310.0190.00016.70
7.2.300.0150.00616.73
7.2.290.0070.01116.82
7.2.260.0080.00815.14
7.2.250.0110.00815.18
7.2.240.0070.00915.09
7.2.230.0060.00614.93
7.2.220.0080.00714.96
7.2.210.0050.01115.07
7.2.200.0060.00815.00
7.2.190.0080.00515.05
7.2.180.0090.00515.11
7.2.170.0030.01115.04
7.2.160.0070.00315.04
7.2.150.0040.00816.94
7.2.140.0090.00616.78
7.2.130.0070.00716.86
7.2.120.0100.00016.70
7.2.110.0070.00716.91
7.2.100.0090.00617.02
7.2.90.0040.01117.08
7.2.80.0080.00817.03
7.2.70.0030.01017.10
7.2.60.0750.00815.97
7.2.50.0890.00915.75
7.2.40.0830.00616.35
7.2.30.0720.01116.20
7.2.20.0780.00816.23
7.2.10.0940.00616.27
7.2.00.1030.01116.20
7.1.330.0130.00115.77
7.1.320.0080.00615.77
7.1.310.0060.00715.84
7.1.300.0060.00815.74
7.1.290.0070.00615.70
7.1.280.0090.00615.74
7.1.270.0030.00815.79
7.1.260.0070.00315.83
7.1.250.0070.00715.96
7.1.240.0030.00715.91
7.1.230.0030.01015.63
7.1.220.0080.00615.78
7.1.210.0120.00315.98
7.1.200.0050.00515.73
7.1.190.0030.00615.60
7.1.180.0150.00015.57
7.1.170.1020.01014.87
7.1.160.0750.01116.23
7.1.150.0740.01016.39
7.1.140.1010.01316.32
7.1.130.0910.00816.34
7.1.120.0690.01116.28
7.1.110.0800.00516.06
7.1.100.0950.00916.29
7.1.90.1020.00716.12
7.1.80.0870.01216.00
7.1.70.0900.00715.63
7.1.60.1270.01524.39
7.1.50.1060.01124.29
7.1.40.1090.00824.19
7.1.30.1060.01524.18
7.1.20.1080.01524.24
7.1.10.0970.01015.29
7.1.00.1090.01015.39
7.0.330.0040.00415.27
7.0.320.0000.00915.37
7.0.310.0030.00615.37
7.0.300.0070.00415.35
7.0.290.0030.01015.39
7.0.280.0110.00015.43
7.0.270.0090.00615.27
7.0.260.0000.01215.28
7.0.250.0000.01315.34
7.0.240.0030.01015.20
7.0.230.0030.01315.57
7.0.220.0060.00615.53
7.0.210.0040.00415.50
7.0.200.0030.00915.63
7.0.190.0090.00015.55
7.0.180.0070.00715.48
7.0.170.0070.00715.47
7.0.160.0040.00815.55
7.0.150.0030.01015.46
7.0.140.0000.01415.64
7.0.130.0100.00615.53
7.0.120.0030.00615.15
7.0.110.0040.01115.36
7.0.100.0090.00915.29
7.0.90.0080.00815.50
7.0.80.0060.00615.54
7.0.70.0070.00715.56
7.0.60.0060.01015.43
7.0.50.0080.00415.68
7.0.40.0030.00913.22
7.0.30.0070.00713.42
7.0.20.0070.00313.41
7.0.10.0000.01413.57
7.0.00.0060.00913.21
5.6.400.0030.01114.36
5.6.390.0060.00614.20
5.6.380.0030.00614.74
5.6.370.0000.00914.40
5.6.360.0080.00414.11
5.6.350.0040.00814.45
5.6.340.0090.00614.43
5.6.330.0090.00914.20
5.6.320.0080.00014.42
5.6.310.0080.00414.39
5.6.300.0000.01314.57
5.6.290.0000.01414.69
5.6.280.0060.00614.38
5.6.270.0060.00314.54
5.6.260.0060.00914.34
5.6.250.0000.01414.57
5.6.240.0060.00614.45
5.6.230.0060.00914.35
5.6.220.0080.00814.66
5.6.210.0040.00714.55
5.6.200.0030.01014.32
5.6.190.0040.01114.61
5.6.180.0100.00314.48
5.6.170.0070.00714.50
5.6.160.0090.00614.32
5.6.150.0070.00314.41
5.6.140.0100.00014.43
5.6.130.0070.00714.32
5.6.120.0090.00014.14
5.6.110.0070.00714.30
5.6.100.0000.01514.04
5.6.90.0030.01014.47
5.6.80.0000.00814.72
5.6.70.0090.00314.27
5.6.60.0060.00314.14
5.6.50.0100.00314.14
5.6.40.0060.00814.65
5.6.30.0040.00814.60
5.6.20.0090.00614.53
5.6.10.0020.00914.38
5.6.00.0030.00614.27

preferences:
29.82 ms | 403 KiB | 5 Q