3v4l.org

run code in 300+ PHP versions simultaneously
<?php $resultArray = [ [ 'nid' => [ [ 'value' => 1, ] ], 'vid' => [ [ 'value' => 2, ] ], 'cid' => [ [ 'value' => 3, ] ], 'field' => [ [ 'target_id' => 4, ] ], ], [ 'nid' => [ [ 'value' => 11, ] ], 'vid' => [ [ 'value' => 22, ] ], 'cid' => [ [ 'value' => 33, ] ], 'field' => [ [ 'target_id' => 44, ] ], ], ]; $test = 1; foreach ($resultArray as $items) { // Echo the current test number echo "Test{$test} = "; $values = []; foreach ($items as $item) { // Get the correct value. if (array_key_exists('value', $item[0])) { $values[] = $item[0]['value']; continue; } if (array_key_exists('target_id', $item[0])) { $values[] = $item[0]['target_id']; continue; } } echo '"' . implode('", "', $values) . '"' . "\n"; $test++; }

Abusive script

This script was stopped while abusing our resources

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.110.0040.00420.94
8.3.100.0060.00324.06
8.3.90.0000.00726.77
8.3.80.0090.00018.43
8.3.70.0050.01018.27
8.3.60.0120.00616.38
8.3.50.0080.00618.08
8.3.40.0030.01418.79
8.3.30.0060.01318.79
8.3.20.0000.00721.77
8.3.10.0040.00421.77
8.3.00.0040.00428.09
8.2.230.0040.00422.58
8.2.220.0030.00637.54
8.2.210.0040.00426.77
8.2.200.0110.00016.88
8.2.190.0140.00016.75
8.2.180.0150.00316.50
8.2.170.0070.00722.96
8.2.160.0100.00722.26
8.2.150.0030.00524.18
8.2.140.0040.00424.66
8.2.130.0050.00328.09
8.2.120.0070.00028.09
8.1.290.0060.00318.88
8.1.280.0120.00325.92
8.1.270.0000.00820.78
8.1.260.0080.00028.09
8.1.250.0000.00828.09
8.0.80.0190.01016.84
8.0.70.0340.01116.70
8.0.60.0510.00416.69
8.0.50.0630.00316.58
8.0.30.0160.00816.94
8.0.20.0240.01017.03
8.0.10.0190.02217.03
8.0.00.0120.01116.83
7.4.220.0230.01916.39
7.4.210.0150.00916.65
7.4.200.0600.00916.63
7.4.190.0370.01116.58
7.4.180.0300.01016.45
7.4.160.0140.00816.53
7.4.150.0220.00916.50
7.4.140.0160.01017.59
7.4.130.0200.00816.57
7.4.120.0190.00816.53
7.4.110.0210.01016.40
7.4.100.0160.00716.44
7.4.90.0160.01216.44
7.4.80.0150.00917.42
7.4.70.0130.00916.44
7.4.60.0120.01316.37
7.4.50.0160.00816.43
7.4.40.0110.01416.55
7.4.30.0170.00816.50
7.4.20.0180.00516.39
7.4.10.0160.00816.49
7.4.00.0120.00916.07
7.3.290.0300.00916.22
7.3.280.0120.00816.30
7.3.270.0270.01216.28
7.3.260.0150.00816.34
7.3.250.0230.00916.23
7.3.240.0190.00416.34
7.3.230.0180.00916.27
7.3.220.0150.01116.42
7.3.210.0160.00816.21
7.3.200.0200.00616.37
7.3.190.0200.00716.32
7.3.180.0080.01216.33
7.3.170.0130.00916.35
7.3.160.0150.00916.32
7.3.150.0180.01616.32
7.3.140.0200.00716.31
7.3.130.0150.00916.35
7.3.120.0160.00616.27
7.3.110.0170.00816.30
7.3.100.0130.01016.26
7.3.90.0150.00816.37
7.3.80.0160.01016.24
7.3.70.0160.01016.32
7.3.60.0170.00816.45
7.3.50.0230.00616.45
7.3.40.0120.01016.34
7.3.30.0130.01016.42
7.3.20.0160.01016.39
7.3.10.0160.00716.46
7.3.00.0170.00916.45
7.2.340.0160.01616.28
7.2.330.0180.00816.53
7.2.320.0190.00716.53
7.2.310.0150.00916.59
7.2.300.0180.00816.56
7.2.290.0160.01116.55
7.2.280.0190.00516.55
7.2.270.0170.00616.63
7.2.260.0170.00716.62
7.2.250.0130.01116.62
7.2.240.0180.00716.64
7.2.230.0200.00516.59
7.2.220.0140.00916.49
7.2.210.0160.01016.39
7.2.200.0170.00716.68
7.2.190.0190.00716.49
7.2.180.0170.01216.57
7.2.170.0120.01516.61
7.2.160.0170.00616.65
7.2.150.0190.01116.57
7.2.140.0420.00916.24
7.2.130.0220.00716.70
7.2.120.0150.00916.69
7.2.110.0280.00916.70
7.2.100.0120.01016.64
7.2.90.0190.00616.74
7.2.80.0200.01016.55
7.2.70.0160.01016.69
7.2.60.0170.00816.77
7.2.50.0150.00816.62
7.2.40.0290.01216.90
7.2.30.0300.01116.92
7.2.20.0520.00815.69
7.2.10.0850.01115.71
7.2.00.0830.01115.59
7.1.330.1340.00414.02
7.1.320.1230.00713.92
7.1.310.0960.00613.97
7.1.300.1310.00913.85
7.1.290.1070.00613.83
7.1.280.1150.00913.88
7.1.270.0250.00715.60
7.1.260.0210.01115.49
7.1.250.0140.00815.67
7.1.240.0180.01815.60
7.1.230.0280.00715.54
7.1.220.0160.01215.57
7.1.210.0250.00415.51
7.1.200.0170.00815.64
7.1.190.0220.01015.54
7.1.180.0260.00315.63
7.1.170.0190.00915.54
7.1.160.0360.01216.04
7.1.150.0300.00816.02
7.1.140.0240.01116.00
7.1.130.0290.01115.90
7.1.120.0330.01015.88
7.1.110.0290.01015.75
7.1.100.0330.01215.73
7.1.90.0290.00815.68
7.1.80.0330.00815.65
7.1.70.0310.00715.45
7.1.60.0420.00821.37
7.1.50.0400.01421.37
7.1.40.0350.01321.15
7.1.30.0380.01121.30
7.1.20.1070.01221.34
7.1.10.0340.00615.29
7.1.00.0250.01215.34
7.0.330.0190.01215.34
7.0.320.0210.00715.29
7.0.310.0230.00415.35
7.0.300.0230.00815.06
7.0.290.0270.00215.24
7.0.280.0130.01615.26
7.0.270.0190.00815.30
7.0.260.0210.00615.18
7.0.250.0370.00715.18
7.0.240.0180.01015.23
7.0.230.0240.00815.31
7.0.220.0170.01115.29
7.0.210.0420.00815.21
7.0.200.0160.01115.35
7.0.190.0250.00415.24
7.0.180.0210.00615.30
7.0.170.0220.00815.31
7.0.160.0290.00815.26
7.0.150.0200.00815.28
7.0.140.0230.00615.24
7.0.130.0200.01015.22
7.0.120.0240.01215.20
7.0.110.0240.00515.18
7.0.100.0230.00915.28
7.0.90.0230.00515.15
7.0.80.0250.00315.27
7.0.70.0210.01015.23
7.0.60.0200.00915.46
7.0.50.0220.01015.36
7.0.40.0190.00915.37
7.0.30.0220.00415.28
7.0.20.0190.01015.29
7.0.10.0260.00415.38
7.0.00.0240.00615.34
5.6.400.0190.01316.04
5.6.390.0270.00816.25
5.6.380.0210.00915.95
5.6.370.0210.00916.13
5.6.360.0230.00616.04
5.6.350.0160.01615.97
5.6.340.0170.01316.01
5.6.330.0240.00515.93
5.6.320.0190.01216.20
5.6.310.0210.01016.19
5.6.300.0200.01216.10
5.6.290.0220.00916.13
5.6.280.0250.00615.98
5.6.270.0200.00915.94
5.6.260.0190.01216.15
5.6.250.0170.01515.89
5.6.240.0180.01116.01
5.6.230.0130.01515.96
5.6.220.0200.00916.01
5.6.210.0210.01016.03
5.6.200.0230.00716.07
5.6.190.0200.00915.96
5.6.180.0210.00915.96
5.6.170.0260.00615.91
5.6.160.0200.01115.94
5.6.150.0190.01115.98
5.6.140.0180.01116.14
5.6.130.0210.01316.05
5.6.120.0220.00916.05
5.6.110.0180.01715.95
5.6.100.0200.01115.96
5.6.90.0210.00916.03
5.6.80.0170.01116.07
5.6.70.0230.00516.02
5.6.60.0230.00615.88
5.6.50.0180.01016.01
5.6.40.0140.01415.96
5.6.30.0220.00815.90
5.6.20.0210.00815.87
5.6.10.0160.01315.88
5.6.00.0130.01515.85

preferences:
36.74 ms | 403 KiB | 5 Q