3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Examples 1 & 2 from http://nl3.php.net/array_column $records = array( 4 => array( 'id' => 2135, 'first_name' => 'John', 'last_name' => 'Doe', ), 8 => array( 'id' => 3245, 'first_name' => 'Sally', 'last_name' => 'Smith', ), 2 => array( 'id' => 5342, 'first_name' => 'Jane', 'last_name' => 'Jones', ), '00013411' => array( 'id' => 5623, 'first_name' => 'Peter', 'last_name' => 'Doe', ) ); // Example 1: original indexes are lost =( print_r(array_column($records, 'first_name')); // Example 2: new indexes are 'id' column print_r(array_column($records, 'last_name', 'id')); // Example 3: full objects by 'last_name' print_r(array_column($records, null, 'last_name')); // Example 4: no pick and no index print_r(array_column($records, null)); // Example 5: objects instead of arrays? $objects = array_map(function($arr) { return (object)$arr; }, $records); print_r($objects); print_r(array_column($records, 'last_name', 'id'));

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.60.0070.01418.43
8.3.50.0090.00821.21
8.3.40.0120.00318.68
8.3.30.0090.00618.59
8.3.20.0060.00318.39
8.3.10.0050.00320.42
8.3.00.0030.00619.26
8.2.180.0120.00616.62
8.2.170.0100.01022.96
8.2.160.0070.00722.12
8.2.150.0050.00324.18
8.2.140.0070.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00419.95
8.2.110.0030.00622.12
8.2.100.0070.00417.72
8.2.90.0040.00419.21
8.2.80.0040.00417.97
8.2.70.0060.00317.63
8.2.60.0000.00917.80
8.2.50.0000.00818.07
8.2.40.0060.00318.22
8.2.30.0050.00219.95
8.2.20.0080.00017.68
8.2.10.0040.00417.84
8.2.00.0060.00317.62
8.1.280.0120.00625.92
8.1.270.0000.00823.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0070.00720.68
8.1.230.0110.00020.98
8.1.220.0000.00818.77
8.1.210.0000.00818.91
8.1.200.0060.00317.35
8.1.190.0040.00417.42
8.1.180.0040.00418.10
8.1.170.0050.00318.74
8.1.160.0040.00418.95
8.1.150.0030.00518.68
8.1.140.0070.00017.45
8.1.130.0030.00317.88
8.1.120.0040.00417.54
8.1.110.0000.00817.46
8.1.100.0000.00817.46
8.1.90.0040.00417.35
8.1.80.0000.00717.42
8.1.70.0070.00017.43
8.1.60.0030.00617.65
8.1.50.0080.00017.40
8.1.40.0040.00417.51
8.1.30.0070.00017.68
8.1.20.0030.00617.60
8.1.10.0040.00417.32
8.1.00.0040.00417.36
8.0.300.0130.00219.46
8.0.290.0000.00716.63
8.0.280.0030.00318.25
8.0.270.0030.00317.19
8.0.260.0040.00418.41
8.0.250.0030.00616.91
8.0.240.0040.00416.88
8.0.230.0070.00016.85
8.0.220.0030.00416.84
8.0.210.0070.00016.79
8.0.200.0000.00716.93
8.0.190.0000.00816.82
8.0.180.0050.00716.97
8.0.170.0030.00516.81
8.0.160.0080.00016.78
8.0.150.0040.00416.71
8.0.140.0050.00516.83
8.0.130.0000.00513.37
8.0.120.0040.00416.80
8.0.110.0040.00416.79
8.0.100.0000.00816.80
8.0.90.0040.00416.83
8.0.80.0110.00416.83
8.0.70.0070.00017.00
8.0.60.0040.00416.82
8.0.50.0040.00416.67
8.0.30.0130.00817.07
8.0.20.0130.00517.40
8.0.10.0040.00416.95
8.0.00.0100.01216.77
7.4.330.0000.00513.43
7.4.320.0030.00316.49
7.4.300.0040.00416.40
7.4.290.0030.00316.60
7.4.280.0030.00516.36
7.4.270.0000.00816.50
7.4.260.0030.00313.33
7.4.250.0040.00416.53
7.4.240.0020.00516.45
7.4.230.0070.00016.41
7.4.220.0100.01016.49
7.4.210.0070.00916.57
7.4.200.0080.00016.61
7.4.190.0030.00316.65
7.4.160.0150.00016.52
7.4.150.0100.00717.40
7.4.140.0080.00917.14
7.4.130.0090.00816.42
7.4.120.0070.01016.43
7.4.110.0070.01016.55
7.4.100.0110.01116.21
7.4.90.0090.00916.36
7.4.80.0110.01119.03
7.4.70.0160.00616.33
7.4.60.0080.00816.54
7.4.50.0060.00316.43
7.4.40.0070.01122.27
7.4.30.0180.00016.51
7.4.00.0120.00015.16
7.3.330.0000.00513.32
7.3.320.0000.00513.09
7.3.310.0000.00716.23
7.3.300.0000.00716.24
7.3.290.0110.00316.28
7.3.280.0090.00716.31
7.3.270.0110.00617.40
7.3.260.0050.01218.24
7.3.250.0120.00616.35
7.3.240.0100.01216.37
7.3.230.0030.01316.39
7.3.210.0110.00616.57
7.3.200.0140.00819.39
7.3.190.0030.01516.45
7.3.180.0100.00516.59
7.3.170.0070.01316.27
7.3.160.0190.00516.34
7.3.120.0080.00814.92
7.2.330.0110.00716.63
7.2.320.0110.00516.71
7.2.310.0160.00316.68
7.2.300.0060.00916.66
7.2.290.0130.01016.59
7.2.00.0070.00719.04
7.1.100.0040.00818.39
7.1.70.0000.01016.78
7.1.60.0100.01319.40
7.1.50.0030.01717.02
7.1.00.0030.07722.48
7.0.200.0000.00816.63
7.0.140.0100.07022.17
7.0.60.0030.06319.90
7.0.50.0070.04017.94
7.0.40.0070.04720.13
7.0.30.0400.04020.30
7.0.20.0270.08020.23
7.0.10.0300.07320.23
7.0.00.0100.08720.23
5.6.280.0100.07020.92
5.6.210.0030.04020.52
5.6.200.0100.08318.27
5.6.190.0070.08020.48
5.6.180.0300.05720.65
5.6.170.0470.07020.44
5.6.160.0130.04020.54
5.6.150.0070.07018.23
5.6.140.0100.04718.15
5.6.130.0100.08718.18
5.6.120.0000.04320.87
5.6.110.0000.06320.96
5.6.100.0070.08021.08
5.6.90.0170.07721.00
5.6.80.0070.07720.51
5.6.70.4330.04720.50
5.5.350.4300.03720.45
5.5.340.0100.07317.93
5.5.330.0130.04020.18
5.5.320.0270.08020.26
5.5.310.0130.04720.26
5.5.300.0070.07717.94
5.5.290.0100.06018.08
5.5.280.0070.05320.98
5.5.270.0070.04020.77
5.5.260.0170.07020.96
5.5.250.0070.08320.69
5.5.240.0130.07720.07
5.4.450.1630.03319.49
5.4.440.1600.04319.11
5.4.430.1670.04019.54
5.4.420.1800.04719.38
5.4.410.1600.04019.10
5.4.400.2030.03719.13
5.4.390.1600.03719.08
5.4.380.1570.03718.90
5.4.370.1630.03019.17
5.4.360.1570.03719.23
5.4.350.1570.03318.75
5.4.340.1030.04719.32
5.4.320.0000.04019.21
5.4.310.0030.04318.75
5.4.300.1300.04019.21
5.4.290.1630.04319.16
5.4.280.1730.04318.97
5.4.270.1600.03319.25
5.4.260.1900.04319.30
5.4.250.1670.04019.15
5.4.240.1630.04318.87
5.4.230.1700.03718.85
5.4.220.1830.04319.22
5.4.210.1630.03018.77
5.4.200.1870.03718.77
5.4.190.1700.04319.16
5.4.180.1770.04019.04
5.4.170.1500.04018.85
5.4.160.1970.03319.15
5.4.150.1800.04018.95
5.4.140.1700.04316.50
5.4.130.1770.04016.53
5.4.120.1830.04016.32
5.4.110.1530.04016.19
5.4.100.1470.04016.42
5.4.90.1500.03716.42
5.4.80.1700.04316.58
5.4.70.1730.03716.42
5.4.60.1830.03716.30
5.4.50.1630.04016.53
5.4.40.1800.04016.60
5.4.30.1500.03716.48
5.4.20.1730.04316.44
5.4.10.1770.04316.51
5.4.00.1770.04015.75
5.3.290.1630.04014.58
5.3.280.1830.04314.57
5.3.270.1770.05014.66
5.3.260.1700.05014.68
5.3.250.1530.04014.68
5.3.240.0070.03314.58
5.3.230.0100.05014.52
5.3.220.0870.05714.54
5.3.210.1530.03714.48
5.3.200.1870.03714.56
5.3.190.1500.04014.63
5.3.180.1830.04314.68
5.3.170.1730.04014.46
5.3.160.1700.04714.64
5.3.150.1770.04314.57
5.3.140.1830.04014.63
5.3.130.1730.04714.46
5.3.120.1970.03714.60
5.3.110.1570.04714.54
5.3.100.0000.04314.28
5.3.90.0030.07313.88
5.3.80.0070.04014.11
5.3.70.0930.05713.93
5.3.60.1530.03713.93
5.3.50.1670.02713.88
5.3.40.1700.04013.95
5.3.30.1800.04314.02
5.3.20.1830.03713.64
5.3.10.1670.03313.66
5.3.00.1630.03013.72
5.2.170.1530.03710.99
5.2.160.1570.03711.20
5.2.150.1430.03011.32
5.2.140.1600.03011.00
5.2.130.1200.03311.15
5.2.120.1330.02311.13
5.2.110.1270.03011.11
5.2.100.1500.04011.26
5.2.90.1370.03711.12
5.2.80.1300.03310.93
5.2.70.1630.02711.18
5.2.60.1370.03310.89
5.2.50.1570.03711.07
5.2.40.1130.02310.90
5.2.30.1030.03310.82
5.2.20.1030.03011.12
5.2.10.1100.02310.93
5.2.00.1100.02310.66
5.1.60.1000.0279.89
5.1.50.1070.02310.16
5.1.40.0070.0239.88
5.1.30.0000.02710.24
5.1.20.0000.03010.26
5.1.10.0000.02710.12
5.1.00.1230.02710.01
5.0.50.0630.0308.48
5.0.40.0770.0278.43
5.0.30.0570.0308.23
5.0.20.0630.0378.32
5.0.10.0630.0278.40
5.0.00.0570.0338.23
4.4.90.0570.0208.23
4.4.80.0530.0138.23
4.4.70.0570.0238.23
4.4.60.0670.0278.23
4.4.50.0470.0178.23
4.4.40.0630.0308.23
4.4.30.0630.0108.23
4.4.20.0500.0178.23
4.4.10.0670.0238.23
4.4.00.0530.0208.23
4.3.110.0670.0308.23
4.3.100.0570.0138.23
4.3.90.0700.0238.23
4.3.80.0530.0308.23
4.3.70.0470.0178.23
4.3.60.0530.0138.23
4.3.50.0430.0138.23
4.3.40.0030.0208.23
4.3.30.0000.0378.23
4.3.20.0070.0278.23
4.3.10.0000.0178.23
4.3.00.0000.0138.23

preferences:
42.96 ms | 401 KiB | 5 Q