3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = '[{"id":37,"slug":"red","stock":true,"name":"Red","default":0,"sizes":"38"},{"id":38,"slug":"red","stock":true,"name":"Red","default":0,"sizes":"40"},{"id":34,"slug":"red","stock":true,"name":"Red","default":0,"sizes":"36"},{"id":26,"slug":"green","stock":true,"name":"Green","default":0,"sizes":"48"}]'; $array = json_decode($json,1); $expected = []; foreach($array as $v) { $expected[$v['slug']][] = $v; } $expected_v2 = []; foreach($expected as $k1=>$v1) { array_push($expected_v2,['slug'=>$k1,'name'=>ucfirst($k1),'sizes'=>$v1]); } print_r($expected_v2); echo json_encode($expected_v2); ?>

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.5.00.0140.01020.02
8.4.150.0030.00014.05
8.4.140.0130.01017.57
8.4.130.0100.00917.79
8.4.120.0030.00520.58
8.4.110.0090.00722.46
8.4.100.0140.00819.33
8.4.90.0110.01018.56
8.4.80.0110.01117.69
8.4.70.0100.01017.92
8.4.60.0070.01218.88
8.4.50.0140.00620.36
8.4.40.0130.00719.50
8.4.30.0150.00617.67
8.4.20.0100.00720.43
8.4.10.0120.00620.55
8.3.280.0160.00718.46
8.3.270.0110.00816.62
8.3.260.0130.00616.87
8.3.250.0080.00518.82
8.3.240.0100.00821.04
8.3.230.0070.00216.56
8.3.220.0050.00417.39
8.3.210.0080.00916.54
8.3.200.0040.00416.67
8.3.190.0080.00517.18
8.3.180.0080.00116.65
8.3.170.0120.00818.84
8.3.160.0120.00617.37
8.3.150.0090.00918.95
8.3.140.0060.01217.04
8.3.130.0100.00718.33
8.3.120.0060.00318.70
8.3.110.0030.00520.94
8.3.100.0000.00916.63
8.3.90.0050.00326.77
8.3.80.0060.00316.75
8.3.70.0110.01116.38
8.3.60.0120.00318.31
8.3.50.0140.00917.34
8.3.40.0110.00418.70
8.3.30.0090.00618.85
8.3.20.0070.00021.89
8.3.10.0050.00320.48
8.3.00.0050.00317.50
8.2.290.0090.00920.65
8.2.280.0090.01018.61
8.2.270.0090.00917.35
8.2.260.0090.00916.87
8.2.250.0030.00620.64
8.2.240.0000.00917.27
8.2.230.0090.00622.58
8.2.220.0040.00424.06
8.2.210.0050.00326.77
8.2.200.0090.00016.63
8.2.190.0110.00416.70
8.2.180.0080.00818.16
8.2.170.0110.00322.96
8.2.160.0040.01122.96
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0080.00018.16
8.2.120.0040.00426.35
8.2.110.0000.00922.11
8.2.100.0070.00418.03
8.2.90.0080.00017.97
8.2.80.0000.00817.97
8.2.70.0080.00017.63
8.2.60.0030.00717.50
8.2.50.0000.00817.55
8.2.40.0050.00319.49
8.2.30.0050.00319.21
8.2.20.0040.00418.14
8.2.10.0040.00419.58
8.2.00.0050.00218.15
8.1.330.0110.01122.00
8.1.320.0160.00416.29
8.1.310.0000.00820.28
8.1.300.0070.00319.77
8.1.290.0100.00030.84
8.1.280.0110.00425.92
8.1.270.0080.00022.16
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0000.01023.89
8.1.230.0070.00420.88
8.1.220.0080.00017.79
8.1.210.0030.00718.98
8.1.200.0000.00817.38
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0000.00818.49
8.1.160.0000.00718.82
8.1.150.0040.00418.90
8.1.140.0070.00019.02
8.1.130.0030.00320.16
8.1.120.0000.00917.52
8.1.110.0000.00817.52
8.1.100.0040.00417.41
8.1.90.0070.00017.41
8.1.80.0000.00817.42
8.1.70.0000.00717.40
8.1.60.0040.00417.59
8.1.50.0000.00817.45
8.1.40.0040.00417.59
8.1.30.0000.00817.64
8.1.20.0040.00417.67
8.1.10.0080.00017.61
8.1.00.0060.00317.56
8.0.300.0000.00719.97
8.0.290.0060.00316.75
8.0.280.0000.00718.39
8.0.270.0030.00316.79
8.0.260.0000.00618.47
8.0.250.0070.00016.95
8.0.240.0020.00516.96
8.0.230.0060.00316.91
8.0.220.0000.00716.89
8.0.210.0000.00716.93
8.0.200.0030.00316.86
8.0.190.0030.00316.82
8.0.180.0000.00716.80
8.0.170.0060.00316.84
8.0.160.0050.00316.80
8.0.150.0040.00416.77
8.0.140.0040.00416.86
8.0.130.0030.00313.30
8.0.120.0040.00416.96
8.0.110.0040.00416.91
8.0.100.0040.00416.89
8.0.90.0070.00016.88
8.0.80.0020.01716.84
8.0.70.0080.00016.76
8.0.60.0000.00716.95
8.0.50.0000.00716.97
8.0.30.0110.00817.28
8.0.20.0110.01417.14
8.0.10.0000.00817.03
8.0.00.0100.00816.82
7.4.330.0000.00515.55
7.4.320.0000.00716.64
7.4.300.0000.00616.57
7.4.290.0070.00016.65
7.4.280.0000.00716.63
7.4.270.0040.00416.52
7.4.260.0030.00616.43
7.4.250.0040.00416.61
7.4.240.0000.00716.54
7.4.230.0000.00716.58
7.4.220.0040.00416.63
7.4.210.0090.00716.65
7.4.200.0000.00816.64
7.4.160.0110.00516.52
7.4.140.0060.01217.86
7.4.130.0150.00316.67
7.4.120.0100.00716.43
7.4.110.0140.00516.48
7.4.100.0180.00716.69
7.4.90.0100.00716.60
7.4.80.0160.00019.39
7.4.70.0060.01216.63
7.4.60.0080.00816.47
7.4.50.0000.01516.47
7.4.40.0130.00316.47
7.4.00.0070.01014.89
7.3.330.0020.00213.10
7.3.320.0060.00013.09
7.3.310.0030.00316.27
7.3.300.0000.00716.36
7.3.290.0060.00716.29
7.3.280.0090.01016.34
7.3.260.0100.00816.38
7.3.240.0120.00716.42
7.3.230.0090.01216.41
7.3.210.0040.01316.61
7.3.200.0030.01316.62
7.3.190.0070.01316.34
7.3.180.0140.00716.37
7.3.170.0120.01216.52
7.3.160.0140.00316.45
7.3.120.0030.01414.65
7.3.110.0100.00814.67
7.3.100.0060.01014.72
7.3.90.0050.00914.56
7.3.80.0050.00914.94
7.3.70.0060.00814.73
7.3.60.0090.00514.82
7.3.50.0070.00814.73
7.3.40.0070.00714.74
7.3.30.0080.00814.82
7.3.20.1950.00515.89
7.3.10.2350.01115.97
7.3.00.1530.00816.09
7.2.330.0110.00716.61
7.2.320.0090.01316.81
7.2.310.0040.01316.71
7.2.300.0130.01016.52
7.2.290.0090.00916.52
7.2.250.0090.01114.80
7.2.240.0070.01314.82
7.2.230.0060.00815.13
7.2.220.0050.01215.22
7.2.210.0050.00715.09
7.2.200.0020.01115.01
7.2.190.0060.00915.07
7.2.180.0080.00515.19
7.2.170.0070.00515.09
7.2.160.0000.01414.92
7.2.150.1540.01115.78
7.2.140.3060.00715.89
7.2.130.2540.00815.82
7.2.120.2150.00815.78
7.2.110.2010.01015.76
7.2.100.2430.01215.71
7.2.90.2260.00615.89
7.2.80.2420.01115.79
7.2.70.2230.00815.95
7.2.60.0310.01116.02
7.2.50.2050.00815.78
7.2.40.1770.00515.70
7.2.30.1710.00816.04
7.2.20.1810.00816.17
7.2.10.1720.01116.04
7.2.00.1710.01215.81
7.1.330.0070.00915.75
7.1.320.0060.00615.88
7.1.310.0060.00615.86
7.1.300.0090.00515.97
7.1.290.0050.00915.82
7.1.280.0030.00815.72
7.1.270.0060.00715.81
7.1.260.0030.01015.79
7.1.250.1010.00514.66
7.1.240.0070.00715.82
7.1.230.0070.01015.42
7.1.220.0040.01115.83
7.1.210.0060.01215.73
7.1.200.0000.01815.99
7.1.190.0000.01315.76
7.1.180.0040.01115.90
7.1.170.0090.00315.79
7.1.160.0030.00915.67
7.1.150.0120.00315.82
7.1.140.0100.00415.89
7.1.130.0100.00315.80
7.1.120.0000.01415.65
7.1.110.0080.00815.97
7.1.100.0070.00215.92
7.1.90.0030.00815.82
7.1.80.0070.00715.85
7.1.70.0080.00415.79
7.1.60.0070.00715.91
7.1.50.0050.01015.83
7.1.40.0060.01015.83
7.1.30.0090.00615.77
7.1.20.0090.00615.76
7.1.10.0070.00715.86
7.1.00.0080.00815.55

preferences:
30.38 ms | 403 KiB | 5 Q