3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = [ 'NUM' => [ 101, 102, 103, ], 'NOM' => [ 'Smith', 'Robson', 'Daniels', ], 'PRENOM' => [ 'Alice', 'Bob', 'Charlie', ], ]; // Grab all possible outer keys $outerKeys = array_keys($data); // Make sure all child arrays are the same size $innerCount = null; foreach($outerKeys as $key) { // Also make sure that we've got a list so that we don't have to keep // track of child keys. For a 7.x polyfill see // https://www.php.net/manual/en/function.array-is-list.php if(!array_is_list($data[$key])){ throw new RuntimeException('Child array is not a list'); } // Count the first item if(null === $innerCount){ $innerCount = count($data[$key]); continue; } // Compare the known count with the current child array if($innerCount !== count($data[$key])){ throw new RuntimeException('Child array does not have equal item count'); } } $lines = []; for($idx = 0; $idx < $innerCount; $idx++){ $buf = []; foreach($outerKeys as $key){ $buf[] = $key . ':' . $data[$key][$idx]; } $lines[] = implode(' ', $buf); } echo implode(PHP_EOL, $lines);

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.140.0140.00617.70
8.4.130.0110.00918.66
8.4.120.0140.00624.41
8.4.110.0150.00518.62
8.4.100.0140.00618.66
8.4.90.0120.01120.33
8.4.80.0050.00818.65
8.4.70.0140.01018.98
8.4.60.0120.00819.03
8.4.50.0130.00718.55
8.4.40.0060.01317.95
8.4.30.0100.01018.73
8.4.20.0130.00718.87
8.4.10.0030.00622.21
8.3.270.0130.00716.48
8.3.260.0130.00616.45
8.3.250.0170.00319.01
8.3.240.0150.00417.18
8.3.230.0060.00416.89
8.3.220.0140.00519.13
8.3.210.0110.00818.27
8.3.200.0050.00416.80
8.3.190.0140.00417.16
8.3.180.0130.00518.86
8.3.170.0070.01020.68
8.3.160.0060.01217.25
8.3.150.0090.00917.37
8.3.140.0080.00016.45
8.3.130.0100.00718.36
8.3.120.0080.00318.99
8.3.110.0030.00616.66
8.3.100.0030.00618.54
8.3.90.0080.00026.77
8.3.80.0050.00516.75
8.3.70.0110.00716.58
8.3.60.0070.01116.63
8.3.50.0070.00718.54
8.3.40.0140.00020.34
8.3.30.0040.01118.57
8.3.20.0000.00824.18
8.3.10.0070.00024.66
8.3.00.0090.00026.16
8.2.290.0110.00820.38
8.2.280.0050.00318.57
8.2.270.0000.00817.13
8.2.260.0040.01416.48
8.2.250.0150.00018.03
8.2.240.0000.00816.59
8.2.230.0040.00420.94
8.2.220.0040.00424.06
8.2.210.0080.01226.77
8.2.200.0090.00018.16
8.2.190.0140.00316.58
8.2.180.0170.00025.92
8.2.170.0060.00918.66
8.2.160.0110.00422.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0070.00026.16
8.2.110.0070.00420.53
8.2.100.0090.00618.34
8.2.90.0000.01117.75
8.2.80.0000.00818.87
8.2.70.0050.00317.63
8.2.60.0060.00318.03
8.2.50.0050.00318.05
8.2.40.0050.00318.28
8.2.30.0040.00418.20
8.2.20.0000.00719.31
8.2.10.0000.00718.06
8.2.00.0030.00519.38
8.1.330.0080.01121.97
8.1.320.0130.00716.14
8.1.310.0110.00716.81
8.1.300.0080.00816.55
8.1.290.0040.00430.84
8.1.280.0140.00025.92
8.1.270.0040.00424.66
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0060.00319.06
8.1.230.0030.00917.77
8.1.220.0000.00817.74
8.1.210.0050.00318.77
8.1.200.0000.00817.35
8.1.190.0000.00817.23
8.1.180.0030.00518.10
8.1.170.0080.00017.62
8.1.160.0050.00319.09
8.1.150.0000.00718.74
8.1.140.0000.00717.46
8.1.130.0070.00018.89
8.1.120.0000.00717.41
8.1.110.0030.00617.52
8.1.100.0150.00317.25
8.1.90.0110.00517.30
8.1.80.0110.00517.28
8.1.70.0130.00317.40
8.1.60.0160.00317.40
8.1.50.0110.00817.50
8.1.40.0110.00917.54
8.1.30.0160.00317.63
8.1.20.0160.00217.53
8.1.10.0150.00317.51
8.1.00.0090.00917.54
8.0.300.0090.00018.77
8.0.290.0080.00016.75
8.0.280.0030.00318.41
8.0.270.0050.00216.84
8.0.260.0000.00618.36
8.0.250.0060.00016.90
8.0.240.0050.00316.98
8.0.230.0100.00517.02
8.0.220.0110.00416.86
8.0.210.0130.00316.85
8.0.200.0090.00916.96
8.0.190.0120.00316.96
8.0.180.0070.00816.80
8.0.170.0150.00016.99
8.0.160.0140.00216.86
8.0.150.0110.00416.95
8.0.140.0090.00616.78
8.0.130.0120.00616.76
8.0.120.0050.01116.92
8.0.110.0080.00816.97
8.0.100.0170.00016.88
8.0.90.0150.00016.95
8.0.80.0160.00017.00
8.0.70.0090.00616.78
8.0.60.0110.00416.88
8.0.50.0150.00016.84
8.0.30.0150.00016.94
8.0.20.0100.00516.94
8.0.10.0120.00316.96
7.4.330.0050.00015.55
7.4.320.0030.00316.41
7.4.300.0170.00016.40
7.4.290.0150.00316.62
7.4.280.0120.00616.49
7.4.270.0180.00016.60
7.4.260.0140.00416.50
7.4.250.0090.00916.62
7.4.240.0170.00016.56
7.4.230.0100.01016.61
7.4.220.0110.00516.43
7.4.210.0150.00016.41
7.4.200.0090.00616.55
7.4.190.0100.00516.55
7.4.180.0120.00316.55
7.4.160.0120.00416.54
7.4.150.0080.00716.50
7.4.140.0150.00016.36
7.4.130.0130.00316.45
7.4.120.0050.01016.38
7.4.110.0140.00016.48
7.4.100.0130.00316.54
7.4.90.0130.00316.43
7.4.80.0100.00616.47
7.4.70.0070.01016.42
7.4.60.0090.00616.34
7.4.50.0160.00016.36
7.4.40.0080.00716.27
7.4.30.0120.00416.53
7.4.20.0090.00616.30
7.4.10.0040.01116.32
7.4.00.0070.00716.52

preferences:
152.7 ms | 403 KiB | 5 Q