3v4l.org

run code in 300+ PHP versions simultaneously
<?php $startingArray = [ [ "subject" => "Physics", "student" => [ ["id" => "00003", "Name" => "Peter", "email" => "peter@schooool.com",], ["id" => "00004", "Name" => "Mary", "email" => "mary@schooool.com",], ["id" => "00005", "Name" => "Jane", "email" => "jane@schooool.com",], ] ], [ "subject" => "Chemistry", "student" => [ ["id" => "00003", "Name" => "Peter", "email" => "peter@schooool.com",], ["id" => "00004", "Name" => "Mary", "email" => "mary@schooool.com",], ["id" => "00005", "Name" => "Jane", "email" => "jane@schooool.com",], ] ], [ "subject" => "Mathematics", "student" => [ ["id" => "00003", "Name" => "Peter", "email" => "peter@schooool.com",], ["id" => "00006", "Name" => "Fred", "email" => "fred@schooool.com",], ["id" => "00007", "Name" => "Wilma", "email" => "wilma@schooool.com",], ] ], [ "subject" => "Biology", "student" => [ ["id" => "00004", "Name" => "Mary", "email" => "mary@schooool.com",], ["id" => "00006", "Name" => "Fred", "email" => "fred@schooool.com",], ["id" => "00008", "Name" => "Alison", "email" => "alison@schooool.com",], ] ] ]; $newArray = []; foreach ($startingArray as $item) { foreach ($item['student'] as $student) { if (empty($newArray[$student['id']])) { $student['subjects'] = []; $newArray[$student['id']] = $student; } $newArray[$student['id']]['subjects'][] = $item['subject']; } } print_r($newArray);

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.10.0050.01216.49
8.5.00.0140.00819.86
8.4.160.0110.01123.85
8.4.150.0020.00114.05
8.4.140.0120.00917.54
8.4.130.0040.00518.01
8.4.120.0120.00820.45
8.4.110.0080.01222.70
8.4.100.0130.00717.61
8.4.90.0140.00620.50
8.4.80.0080.00620.43
8.4.70.0090.00720.54
8.4.60.0090.01018.75
8.4.50.0090.00922.39
8.4.40.0090.00019.19
8.4.30.0110.00822.59
8.4.20.0060.01320.39
8.4.10.0040.01122.52
8.3.290.0080.01218.41
8.3.280.0130.01018.54
8.3.270.0140.00616.79
8.3.260.0140.00316.48
8.3.250.0110.00819.10
8.3.240.0080.01216.59
8.3.230.0130.00216.86
8.3.220.0090.00819.04
8.3.210.0130.00716.77
8.3.200.0100.01116.39
8.3.190.0110.00916.93
8.3.180.0140.00518.16
8.3.170.0130.01017.13
8.3.160.0060.00318.46
8.3.150.0060.01219.14
8.3.140.0000.00816.42
8.3.130.0130.00316.58
8.3.120.0030.00618.96
8.3.110.0060.00316.62
8.3.100.0030.00724.06
8.3.90.0070.00026.77
8.3.80.0060.00318.56
8.3.70.0070.01116.60
8.3.60.0080.00618.11
8.3.50.0090.00418.24
8.3.40.0070.01018.67
8.3.30.0070.00718.71
8.3.20.0030.00522.52
8.3.10.0040.00421.73
8.3.00.0040.00422.30
8.2.300.0130.00618.20
8.2.290.0090.01016.64
8.2.280.0090.00918.30
8.2.270.0120.00317.09
8.2.260.0040.00416.79
8.2.250.0080.00016.70
8.2.240.0040.00417.32
8.2.230.0040.00420.94
8.2.220.0060.00337.54
8.2.210.0040.00426.77
8.2.200.0090.00016.50
8.2.190.0120.00316.88
8.2.180.0120.00325.92
8.2.170.0060.00919.10
8.2.160.0180.00020.57
8.2.150.0040.00424.18
8.2.140.0000.00724.66
8.2.130.0070.00026.16
8.2.120.0100.00326.16
8.2.110.0060.00622.16
8.2.100.0000.01118.03
8.2.90.0000.00817.91
8.2.80.0040.00418.98
8.2.70.0000.00817.63
8.2.60.0030.00617.63
8.2.50.0030.00617.93
8.2.40.0050.00318.04
8.2.30.0050.00219.32
8.2.20.0040.00418.20
8.2.10.0030.00519.32
8.2.00.0020.00519.34
8.1.340.0120.00817.36
8.1.330.0090.01116.21
8.1.320.0110.00718.41
8.1.310.0050.00316.82
8.1.300.0070.00318.70
8.1.290.0040.00430.84
8.1.280.0070.00725.92
8.1.270.0000.00820.48
8.1.260.0060.00326.35
8.1.250.0030.00628.09
8.1.240.0030.00623.86
8.1.230.0080.00320.96
8.1.220.0030.00617.77
8.1.210.0060.00318.77
8.1.200.0000.00817.35
8.1.190.0000.00917.23
8.1.180.0040.00418.95
8.1.170.0000.00717.62
8.1.160.0050.00319.07
8.1.150.0030.00618.85
8.1.140.0030.00520.80
8.1.130.0000.00820.12
8.1.120.0070.00017.46
8.1.110.0000.00717.36
8.1.100.0040.00817.48
8.1.90.0050.00317.43
8.1.80.0040.00417.36
8.1.70.0030.00717.52
8.1.60.0080.00017.53
8.1.50.0030.00617.44
8.1.40.0060.00317.43
8.1.30.0050.00317.64
8.1.20.0070.00017.67
8.1.10.0040.00417.43
8.1.00.0040.00417.35
8.0.300.0040.00420.13
8.0.290.0040.00416.75
8.0.280.0070.00018.46
8.0.270.0070.00017.26
8.0.260.0000.00720.13
8.0.250.0000.00716.85
8.0.240.0030.00316.87
8.0.230.0070.00016.88
8.0.220.0030.00316.90
8.0.210.0060.00316.87
8.0.200.0060.00016.96
8.0.190.0070.00016.97
8.0.180.0000.00716.84
8.0.170.0090.00016.82
8.0.160.0060.00316.98
8.0.150.0050.00316.82
8.0.140.0060.00316.87
8.0.130.0030.00313.32
8.0.120.0030.00516.77
8.0.110.0000.00716.95
8.0.100.0070.00016.70
8.0.90.0080.00016.86
8.0.80.0040.01116.83
8.0.70.0070.00016.80
8.0.60.0000.00816.98
8.0.50.0040.00416.80
8.0.30.0110.00717.19
8.0.20.0090.01216.81
8.0.10.0050.00216.90
8.0.00.0140.00616.61
7.4.330.0000.00515.55
7.4.320.0000.00616.52
7.4.300.0000.00716.43
7.4.290.0080.00016.64
7.4.280.0040.00416.50
7.4.270.0040.00416.67
7.4.260.0000.00613.21
7.4.250.0040.00416.42
7.4.240.0050.00216.52
7.4.230.0050.00316.58
7.4.220.0030.00316.58
7.4.210.0070.01016.52
7.4.200.0000.00716.61
7.4.130.0070.01016.63
7.4.120.0110.00816.60
7.4.110.0100.00616.39
7.4.100.0050.01416.44
7.4.90.0080.01116.52
7.4.80.0070.01119.39
7.4.70.0080.00816.57
7.4.60.0080.00816.29
7.4.50.0080.00816.59
7.4.40.0140.00416.68
7.4.10.0100.00615.17
7.4.00.0060.00915.06
7.3.330.0030.00516.39
7.3.320.0030.00313.20
7.3.310.0030.00316.32
7.3.300.0030.00316.37
7.3.290.0000.00816.27
7.3.280.0060.01016.27
7.3.260.0120.00816.40
7.3.240.0120.00516.51
7.3.230.0090.00916.44
7.3.210.0120.00616.33
7.3.200.0150.00816.37
7.3.190.0060.01016.66
7.3.180.0030.01416.59
7.3.170.0130.00316.37
7.3.160.0070.01316.52
7.3.130.0070.01014.93
7.3.120.0100.00714.81
7.3.110.0080.00914.67
7.3.100.0090.00714.71
7.3.90.0040.01014.87
7.3.80.0070.00614.75
7.3.70.0080.00414.75
7.3.60.0050.00914.75
7.3.50.0050.01014.87
7.3.40.0070.00914.69
7.3.30.0070.00514.68
7.3.20.0050.00916.00
7.3.10.0070.00815.92
7.3.00.0020.01215.86
7.2.330.0090.01216.80
7.2.320.0130.00916.57
7.2.310.0170.00016.71
7.2.300.0070.01016.63
7.2.290.0060.01016.83
7.2.260.0000.01415.20
7.2.250.0130.00514.86
7.2.240.0050.01115.08
7.2.230.0080.00815.17
7.2.220.0070.00715.00
7.2.210.0070.00615.12
7.2.200.0070.00914.95
7.2.190.0060.00814.86
7.2.180.0060.00814.88
7.2.170.0070.00714.91
7.2.160.0040.00815.11
7.2.150.0070.00916.35
7.2.140.0070.00916.21
7.2.130.0030.01316.41
7.2.120.0080.00616.29
7.2.110.0090.00616.16
7.2.100.0080.00716.26
7.2.90.0060.01116.22
7.2.80.0050.00916.39
7.2.70.0100.00916.27
7.2.60.0070.00716.27
7.2.50.0080.00716.26
7.2.40.0080.00616.21
7.2.30.0090.00616.22
7.2.20.0080.00616.28
7.2.10.0110.00516.30
7.2.00.0070.00816.23
7.1.330.0030.01015.89
7.1.320.0060.00715.23
7.1.310.0080.00615.21
7.1.300.0080.00615.12
7.1.290.0060.00915.10
7.1.280.0070.00415.09
7.1.270.0050.00815.08
7.1.260.0060.00815.23
7.1.250.0050.01015.14
7.1.240.0050.01015.75
7.1.230.0040.00715.84
7.1.220.0030.01115.83
7.1.210.0030.01115.87
7.1.200.0080.00515.65
7.1.190.0080.00815.70
7.1.180.0080.00615.94
7.1.170.0080.00515.76
7.1.160.0030.01215.93
7.1.150.0030.01015.91
7.1.140.0030.01115.68
7.1.130.0040.00615.73
7.1.120.0080.00615.85
7.1.110.0050.00715.61
7.1.100.0060.00815.75
7.1.90.0020.01215.69
7.1.80.0110.00215.81
7.1.70.0090.00515.83
7.1.60.0050.00815.63
7.1.50.0070.00615.68
7.1.40.0100.00515.87
7.1.30.0080.00315.72
7.1.20.0060.00515.76
7.1.10.0070.00815.57
7.1.00.0020.01315.88

preferences:
31.23 ms | 403 KiB | 5 Q