3v4l.org

run code in 300+ PHP versions simultaneously
<?php function array_column1($input = null, $columnKey = null, $indexKey = null) { // Using func_get_args() in order to check for proper number of // parameters and trigger errors exactly as the built-in array_column() // does in PHP 5.5. $params = func_get_args(); switch (func_num_args()) { case 0: trigger_error('array_column() expects at least 2 parameters, 0 given', E_USER_WARNING); return null; case 1: trigger_error('array_column() expects at least 2 parameters, 1 given', E_USER_WARNING); return null; } if (!is_array($params[0])) { trigger_error('array_column() expects parameter 1 to be array, ' . gettype($params[0]) . ' given', E_USER_WARNING); return null; } if (!is_int($params[1]) && !is_string($params[1]) && !(is_object($params[1]) && method_exists($params[1], '__toString')) ) { trigger_error('array_column(): The column key should be either a string or an integer', E_USER_WARNING); return false; } if (isset($params[2]) && !is_int($params[2]) && !is_string($params[2]) && !(is_object($params[2]) && method_exists($params[2], '__toString')) ) { trigger_error('array_column(): The index key should be either a string or an integer', E_USER_WARNING); return false; } $paramsInput = $params[0]; $paramsColumnKey = (string) $params[1]; $paramsIndexKey = (isset($params[2]) ? (string) $params[2] : null); $resultArray = array(); foreach ($paramsInput as $row) { $key = $value = null; $keySet = $valueSet = false; if ($paramsIndexKey !== null && array_key_exists($paramsIndexKey, $row)) { $keySet = true; $key = $row[$paramsIndexKey]; } if (is_array($row) && array_key_exists($paramsColumnKey, $row)) { $valueSet = true; $value = $row[$paramsColumnKey]; } if ($valueSet) { if ($keySet) { $resultArray[$key] = $value; } else { $resultArray[] = $value; } } } return $resultArray; } var_dump( array_column1( array( array( 'a' => null, 'b' => 16, ), ), 'b', 'a' ) );

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.0090.01218.43
8.3.50.0130.01022.16
8.3.40.0040.01118.79
8.3.30.0070.00719.05
8.3.20.0000.00820.16
8.3.10.0030.00522.09
8.3.00.0060.00322.52
8.2.180.0030.01416.88
8.2.170.0120.00322.96
8.2.160.0070.00720.89
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0080.00019.36
8.2.110.0000.01120.99
8.2.100.0060.00617.72
8.2.90.0000.00819.17
8.2.80.0000.00918.05
8.2.70.0000.00917.50
8.2.60.0000.00817.93
8.2.50.0050.00318.07
8.2.40.0040.00418.16
8.2.30.0040.00418.06
8.2.20.0040.00417.78
8.2.10.0050.00317.69
8.2.00.0040.00417.81
8.1.280.0070.00725.92
8.1.270.0000.00823.79
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0090.00621.37
8.1.230.0060.00619.09
8.1.220.0060.00317.74
8.1.210.0050.00318.77
8.1.200.0040.00417.35
8.1.190.0040.00417.51
8.1.180.0060.00318.10
8.1.170.0090.00018.58
8.1.160.0000.00722.00
8.1.150.0080.00018.75
8.1.140.0040.00417.57
8.1.130.0000.00717.91
8.1.120.0000.00717.53
8.1.110.0000.00717.50
8.1.100.0040.00417.42
8.1.90.0000.00717.47
8.1.80.0000.01017.38
8.1.70.0000.00817.41
8.1.60.0030.00617.67
8.1.50.0000.00817.60
8.1.40.0080.00017.55
8.1.30.0040.00417.64
8.1.20.0050.00317.68
8.1.10.0060.00317.59
8.1.00.0000.00717.57
8.0.300.0040.00418.77
8.0.290.0050.00217.18
8.0.280.0040.00418.54
8.0.270.0030.00317.33
8.0.260.0060.00316.87
8.0.250.0040.00417.03
8.0.240.0000.00716.97
8.0.230.0040.00416.92
8.0.220.0030.00316.99
8.0.210.0030.00316.88
8.0.200.0040.00417.07
8.0.190.0070.00017.02
8.0.180.0040.00417.01
8.0.170.0040.00417.01
8.0.160.0000.00816.82
8.0.150.0070.00016.82
8.0.140.0000.00716.80
8.0.130.0030.00313.34
8.0.120.0000.00816.89
8.0.110.0000.00816.98
8.0.100.0040.00416.99
8.0.90.0080.00016.80
8.0.80.0090.01316.91
8.0.70.0000.00816.88
8.0.60.0050.00216.99
8.0.50.0040.00416.95
8.0.30.0160.00617.05
8.0.20.0110.00717.42
8.0.10.0070.00017.13
8.0.00.0080.01116.84
7.4.330.0020.00215.19
7.4.320.0030.00316.48
7.4.300.0030.00316.57
7.4.290.0000.00716.64
7.4.280.0040.00416.60
7.4.270.0000.00716.62
7.4.260.0050.00316.44
7.4.250.0040.00416.54
7.4.240.0040.00416.65
7.4.230.0040.00416.64
7.4.220.0060.01016.68
7.4.210.0050.01116.65
7.4.200.0040.00416.64
7.4.190.0000.00716.82
7.4.160.0080.00816.51
7.4.150.0070.01017.40
7.4.140.0120.00917.86
7.4.130.0120.00416.57
7.4.120.0080.00816.64
7.4.110.0100.00716.43
7.4.100.0110.00716.54
7.4.90.0110.00716.63
7.4.80.0150.01216.64
7.4.70.0060.01216.55
7.4.60.0060.01116.48
7.4.50.0000.00816.27
7.4.40.0060.00622.77
7.4.30.0160.00016.62
7.4.00.0060.00914.96
7.3.330.0000.00613.27
7.3.320.0050.00013.21
7.3.310.0050.00316.44
7.3.300.0030.00316.28
7.3.290.0060.00916.36
7.3.280.0090.01016.38
7.3.270.0090.00917.40
7.3.260.0210.00316.71
7.3.250.0090.00916.63
7.3.240.0060.01216.55
7.3.230.0130.00616.39
7.3.210.0100.00716.66
7.3.200.0060.01319.39
7.3.190.0030.01316.72
7.3.180.0080.00816.27
7.3.170.0130.00316.65
7.3.160.0110.00716.49
7.3.120.0060.00914.95
7.3.10.0080.00616.66
7.3.00.0040.01216.49
7.2.330.0190.00016.88
7.2.320.0140.00716.82
7.2.310.0090.00616.83
7.2.300.0170.00016.66
7.2.290.0070.01016.56
7.2.130.0070.00717.06
7.2.120.0000.01416.92
7.2.110.0030.00917.04
7.2.100.0090.00616.82
7.2.90.0090.00616.87
7.2.80.0000.01516.98
7.2.70.0030.01417.01
7.2.60.0060.00917.06
7.2.50.0030.01016.91
7.2.40.0040.00816.96
7.2.30.0100.00016.87
7.2.20.0070.00717.14
7.2.10.0050.00516.99
7.2.00.0050.00818.06
7.1.250.0030.01015.76
7.1.100.0060.00618.01
7.1.70.0040.00717.21
7.1.60.0140.01119.82
7.1.50.0090.01516.96
7.1.00.0030.07722.36
7.0.200.0080.00416.68
7.0.140.0030.07022.13
7.0.60.0070.05719.99
7.0.50.0030.04017.98
7.0.40.0000.04720.30
7.0.30.0700.05720.16
7.0.20.0370.08020.21
7.0.10.0230.03320.30
7.0.00.0100.06720.07
5.6.280.0030.07321.06
5.6.210.0100.08020.78
5.6.200.0030.06718.25
5.6.190.0070.04020.33
5.6.180.0070.08720.57
5.6.170.0400.07720.47
5.6.160.0100.09020.61
5.6.150.0030.09018.17
5.6.140.0130.06718.13
5.6.130.0100.07318.13
5.6.120.0070.04720.98
5.6.110.0070.08721.05
5.6.100.0230.05321.00
5.6.90.0070.08021.02
5.6.80.0130.07720.41
5.6.70.0230.08020.50
5.5.350.0030.03320.45
5.5.340.0130.06317.96
5.5.330.0130.07320.43
5.5.320.0300.04720.35
5.5.310.0200.05320.37
5.5.300.0070.03718.05
5.5.290.0070.07018.02
5.5.280.0000.07020.75
5.5.270.0070.08020.98
5.5.260.0100.07720.91
5.5.250.0100.05320.70
5.5.240.0130.05320.37
5.4.450.0430.05719.16
5.4.440.0500.06019.70
5.4.430.0570.06019.54
5.4.420.0530.06019.38
5.4.410.0170.05018.71
5.4.400.1070.06018.82
5.4.390.0230.05718.81
5.4.380.0270.06718.79
5.4.370.0270.03718.75
5.4.360.0130.03718.75
5.4.350.0060.03812.04
5.4.340.0070.04012.03
5.4.320.0060.03912.52
5.4.310.0050.04012.52
5.4.300.0100.04212.53
5.4.290.0100.03512.52
5.4.280.0050.03612.41
5.4.270.0040.03712.42
5.4.260.0070.04712.42
5.4.250.0090.03712.42
5.4.240.0060.03612.42
5.4.230.0050.04312.41
5.4.220.0090.03612.41
5.4.210.0070.03712.41
5.4.200.0070.04012.41
5.4.190.0090.04112.41
5.4.180.0040.03712.41
5.4.170.0130.04712.39
5.4.160.0190.04212.39
5.4.150.0100.05112.39
5.4.140.0180.04112.07
5.4.130.0140.04712.06
5.4.120.0150.04312.02
5.4.110.0260.09212.02
5.4.100.0150.04312.01
5.4.90.0170.04112.02
5.4.80.0200.03812.02
5.4.70.0120.04412.02
5.4.60.0150.04212.01
5.4.50.0280.06012.00
5.4.40.0190.03812.00
5.4.30.0200.04111.99
5.4.20.0140.04411.99
5.4.10.0150.04411.99
5.4.00.0140.04211.48
5.3.290.0050.04012.80
5.3.280.0040.04312.71
5.3.270.0210.04012.73
5.3.260.0170.04412.72
5.3.250.0190.04112.72
5.3.240.0140.04612.72
5.3.230.0220.07012.71
5.3.220.0160.04412.68
5.3.210.0180.04312.68
5.3.200.0160.04412.68
5.3.190.0170.04512.67
5.3.180.0170.04312.68
5.3.170.0160.04512.67
5.3.160.0170.04212.68
5.3.150.0370.08512.67
5.3.140.0150.04512.66
5.3.130.0150.04512.66
5.3.120.0190.04112.66
5.3.110.0170.04412.66
5.3.100.0140.04612.14
5.3.90.0280.06112.13
5.3.80.0170.04312.11
5.3.70.0150.04512.11
5.3.60.0140.04712.09
5.3.50.0180.07212.04
5.3.40.0090.05012.04
5.3.30.0170.04012.00
5.3.20.0170.04211.78
5.3.10.0160.04011.75
5.3.00.0360.08111.73
5.2.170.0140.0349.24
5.2.160.0120.0369.23
5.2.150.0100.0379.23
5.2.140.0150.0339.23
5.2.130.0100.0379.20
5.2.120.0100.0369.20
5.2.110.0150.0329.20
5.2.100.0100.0379.21
5.2.90.0280.0789.20
5.2.80.0090.0379.19
5.2.70.0100.0379.19
5.2.60.0110.0379.15
5.2.50.0180.0309.11
5.2.40.0100.0399.09
5.2.30.0140.0359.07
5.2.20.0320.0799.06
5.2.10.0150.0338.96
5.2.00.0110.0368.81
5.1.60.0110.0308.10
5.1.50.0140.0298.10
5.1.40.0090.0328.09
5.1.30.0110.0338.43
5.1.20.0130.0308.46
5.1.10.0130.0308.18
5.1.00.0120.0298.18
5.0.50.0070.0276.66
5.0.40.0110.0216.52
5.0.30.0070.0376.34
5.0.20.0050.0276.31
5.0.10.0120.0196.29
5.0.00.0070.0386.28
4.4.90.0240.0614.78
4.4.80.0090.0164.75
4.4.70.0070.0194.75
4.4.60.0060.0194.76
4.4.50.0080.0174.77
4.4.40.0070.0304.71
4.4.30.0070.0194.76
4.4.20.0100.0164.84
4.4.10.0100.0154.85
4.4.00.0070.0294.76
4.3.110.0050.0204.67
4.3.100.0060.0194.66
4.3.90.0110.0144.64
4.3.80.0100.0264.58
4.3.70.0070.0184.63
4.3.60.0050.0204.63
4.3.50.0050.0204.63
4.3.40.0060.0284.54
4.3.30.0050.0203.34
4.3.20.0060.0183.34
4.3.10.0060.0173.29
4.3.00.0070.0236.92

preferences:
56.64 ms | 401 KiB | 5 Q