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(); if (!isset($params[0])) { trigger_error('array_column() expects at least 2 parameters, 0 given', E_USER_WARNING); return null; } elseif (!isset($params[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, ), ), '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.0120.00318.18
8.3.50.0140.00522.05
8.3.40.0060.01518.97
8.3.30.0040.01118.71
8.3.20.0040.00418.87
8.3.10.0000.00821.28
8.3.00.0070.00021.89
8.2.180.0190.00316.75
8.2.170.0150.00322.96
8.2.160.0200.00020.52
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0060.00917.75
8.2.110.0030.00622.20
8.2.100.0040.00717.84
8.2.90.0070.00019.16
8.2.80.0050.00318.16
8.2.70.0000.00817.73
8.2.60.0040.00418.05
8.2.50.0030.00518.07
8.2.40.0040.00718.32
8.2.30.0040.00419.82
8.2.20.0040.00417.66
8.2.10.0040.00417.88
8.2.00.0030.00617.87
8.1.280.0100.00725.92
8.1.270.0030.00622.31
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0100.00022.46
8.1.230.0080.00321.03
8.1.220.0000.00818.77
8.1.210.0040.00418.93
8.1.200.0060.00317.23
8.1.190.0040.00417.55
8.1.180.0050.00318.10
8.1.170.0000.00818.64
8.1.160.0080.00018.86
8.1.150.0050.00318.68
8.1.140.0040.00417.50
8.1.130.0070.00017.78
8.1.120.0000.00717.42
8.1.110.0040.00417.40
8.1.100.0040.00417.51
8.1.90.0040.00417.35
8.1.80.0050.00317.56
8.1.70.0000.00817.38
8.1.60.0030.00617.70
8.1.50.0000.00817.44
8.1.40.0040.00417.47
8.1.30.0030.00617.72
8.1.20.0060.00317.64
8.1.10.0050.00317.52
8.1.00.0070.00017.48
8.0.300.0060.00320.15
8.0.290.0030.00516.75
8.0.280.0000.00718.55
8.0.270.0040.00417.32
8.0.260.0070.00016.93
8.0.250.0040.00417.01
8.0.240.0030.00616.93
8.0.230.0000.00717.02
8.0.220.0030.00316.88
8.0.210.0000.00716.93
8.0.200.0000.00617.07
8.0.190.0000.00717.04
8.0.180.0040.00416.85
8.0.170.0080.00016.98
8.0.160.0080.00016.86
8.0.150.0000.00916.91
8.0.140.0030.00616.80
8.0.130.0000.00513.38
8.0.120.0070.00016.96
8.0.110.0050.00216.91
8.0.100.0000.00716.93
8.0.90.0000.00817.02
8.0.80.0140.00316.83
8.0.70.0040.00416.93
8.0.60.0000.00717.01
8.0.50.0000.00716.98
8.0.30.0110.00817.06
8.0.20.0090.01017.40
8.0.10.0040.00416.93
8.0.00.0140.00516.81
7.4.330.0000.00513.43
7.4.320.0030.00316.62
7.4.300.0000.00716.51
7.4.290.0050.00316.49
7.4.280.0000.00816.57
7.4.270.0040.00416.57
7.4.260.0030.00313.24
7.4.250.0070.00016.53
7.4.240.0040.00416.71
7.4.230.0030.00316.76
7.4.220.0060.01216.70
7.4.210.0080.00716.50
7.4.200.0040.00416.73
7.4.190.0000.00716.79
7.4.160.0140.00316.54
7.4.150.0100.00717.40
7.4.140.0120.00617.86
7.4.130.0050.01116.61
7.4.120.0070.01016.57
7.4.110.0140.00916.48
7.4.100.0040.01316.70
7.4.90.0140.00516.65
7.4.80.0120.00819.37
7.4.70.0080.00816.45
7.4.60.0030.01416.43
7.4.50.0060.00316.61
7.4.40.0100.00722.27
7.4.30.0090.00916.75
7.4.00.0070.01015.17
7.3.330.0000.00513.24
7.3.320.0000.00513.28
7.3.310.0070.00016.41
7.3.300.0000.00716.28
7.3.290.0000.01416.43
7.3.280.0080.00716.40
7.3.270.0130.00317.40
7.3.260.0130.00318.24
7.3.250.0080.01216.44
7.3.240.0030.01716.49
7.3.230.0070.01016.54
7.3.210.0060.01116.45
7.3.200.0090.00919.39
7.3.190.0070.01016.34
7.3.180.0100.00616.61
7.3.170.0120.00916.49
7.3.160.0110.00616.40
7.3.120.0090.00614.85
7.3.10.0070.01116.51
7.3.00.0110.00316.27
7.2.330.0140.00316.79
7.2.320.0100.00616.57
7.2.310.0140.01016.50
7.2.300.0100.00816.78
7.2.290.0070.01016.80
7.2.130.0100.01016.72
7.2.120.0120.00316.47
7.2.110.0130.01016.71
7.2.100.0230.00516.84
7.2.90.0170.01216.63
7.2.80.0160.00916.34
7.2.70.0150.00916.64
7.2.60.0120.00816.96
7.2.50.0260.00616.59
7.2.40.0040.01116.76
7.2.30.0000.01316.70
7.2.20.0140.00716.84
7.2.10.0070.00716.57
7.2.00.0130.00417.73
7.1.250.0110.00015.65
7.1.100.0130.01316.44
7.1.70.0040.00417.16
7.1.60.0000.01017.38
7.1.50.0030.01517.02
7.1.40.0170.00316.72
7.1.30.0060.00616.51
7.1.20.0070.00716.89
7.1.10.0000.00816.66
7.1.00.0030.00516.66
7.0.200.0070.00016.81
7.0.190.0000.01416.55
7.0.180.0080.00616.24
7.0.170.0030.00716.38
7.0.160.0030.00616.12
7.0.150.0090.00316.18
7.0.140.0000.00716.43
7.0.130.0000.00816.82
7.0.120.0050.00216.54
7.0.110.0080.00016.35
7.0.100.0000.00816.35
7.0.90.0050.00216.44
7.0.80.0050.00316.59
7.0.70.0040.00416.57
7.0.60.0000.00915.95
7.0.50.0040.00416.38
7.0.40.0000.00715.21
7.0.30.0030.00615.21
7.0.20.0000.00715.21
7.0.10.0000.01015.21
7.0.00.0000.00915.21
5.6.300.0170.05520.81
5.6.290.0100.03620.69
5.6.280.0000.04720.80
5.6.270.0030.04821.09
5.6.260.0100.03520.85
5.6.250.0000.04521.04
5.6.240.0100.04220.98
5.6.230.0100.04220.99
5.6.220.0070.04720.89
5.6.210.0100.04321.05
5.6.200.0000.04920.97
5.6.190.0030.05221.01
5.6.180.0030.04221.01
5.6.170.0260.04320.88
5.6.160.0100.03621.04
5.6.150.0070.04320.84
5.6.140.0000.04520.94
5.6.130.0030.04920.84
5.6.120.0100.03620.91
5.6.110.0030.04220.74
5.6.100.0030.04820.82
5.6.90.0030.04820.77
5.6.80.0100.03220.23
5.6.70.0030.03920.32
5.6.60.0070.03620.19
5.6.50.0030.03820.43
5.6.40.0060.03820.36
5.6.30.0030.03820.36
5.6.20.0200.03320.20
5.6.10.0030.03820.23
5.6.00.0000.04520.40
5.5.380.0030.04817.63
5.5.370.0030.04517.67
5.5.360.0060.04117.64
5.5.350.0030.04417.62
5.5.340.0030.04118.10
5.5.330.0000.04217.73
5.5.320.0030.04018.14
5.5.310.0070.04018.09
5.5.300.0070.03618.09
5.5.290.0070.03917.70
5.5.280.0000.04517.74
5.5.270.0060.03718.00
5.5.260.0030.04218.00
5.5.250.0070.04017.90
5.5.240.0030.04217.48
5.5.230.0030.04617.48
5.5.220.0030.04017.38
5.5.210.0030.03717.55
5.5.200.0030.03817.19
5.5.190.0000.04117.35
5.5.180.0100.04217.47
5.5.160.0030.04617.21
5.5.150.0030.04317.40
5.5.140.0000.04317.09
5.5.130.0030.03817.38
5.5.120.0070.05317.48
5.5.110.0100.03217.09
5.5.100.0170.03717.34
5.5.90.0000.04117.37
5.5.80.0070.06017.30
5.5.70.0000.03917.12
5.5.60.0030.04017.32
5.5.50.0030.06117.38
5.5.40.0100.02917.33
5.5.30.0030.04216.98
5.5.20.0030.03617.34
5.5.10.0030.04017.25
5.5.00.0060.03817.23
5.4.450.0000.04819.46
5.4.440.0000.04419.28
5.4.430.0140.04919.39
5.4.420.0000.04319.38
5.4.410.0030.03919.14
5.4.400.0040.03918.95
5.4.390.0030.04418.94
5.4.380.0000.03918.91
5.4.370.0030.04319.21
5.4.360.0070.03419.08
5.4.350.0000.04219.07
5.4.340.0000.04118.95
5.4.320.0030.04019.25
5.4.310.0070.03719.16
5.4.300.0030.04519.11
5.4.290.0000.04119.23
5.4.280.0060.03819.09
5.4.270.0030.04419.06
5.4.260.0030.03918.96
5.4.250.0070.03619.22
5.4.240.0000.03918.94
5.4.230.0100.03219.05
5.4.220.0030.04819.11
5.4.210.0000.04519.15
5.4.200.0000.04518.93
5.4.190.0030.04018.89
5.4.180.0030.04018.89
5.4.170.0100.05119.07
5.4.160.0040.03919.20
5.4.150.0060.04219.05
5.4.140.0000.03916.55
5.4.130.0030.03416.62
5.4.120.0030.03516.71
5.4.110.0100.03216.63
5.4.100.0030.03616.71
5.4.90.0090.02816.75
5.4.80.0070.03916.61
5.4.70.0100.03316.70
5.4.60.0070.08616.43
5.4.50.0000.04216.71
5.4.40.0000.04116.51
5.4.30.0030.03816.45
5.4.20.0030.03816.57
5.4.10.0060.03416.70
5.4.00.0030.03315.85
5.3.290.0130.05015.21
5.3.280.0040.03915.21
5.3.270.0060.07715.21
5.3.260.0030.04115.21
5.3.250.0070.05215.21
5.3.240.0030.03815.21
5.3.230.0070.03715.21
5.3.220.0030.03715.21
5.3.210.0030.04015.21
5.3.200.0070.03615.21
5.3.190.0030.05915.21
5.3.180.0070.03115.21
5.3.170.0030.03415.21
5.3.160.0060.04115.21
5.3.150.0030.04115.21
5.3.140.0030.04015.21
5.3.130.0000.04315.21
5.3.120.0000.03915.21
5.3.110.0030.03915.21
5.3.100.0100.03415.21
5.3.90.0000.04115.21
5.3.80.0000.03715.21
5.3.70.0030.03715.21
5.3.60.0030.03715.21
5.3.50.0030.03515.21
5.3.40.0030.03315.21
5.3.30.0070.03415.21
5.3.20.0100.03115.21
5.3.10.0030.03615.21
5.3.00.0000.03715.21

preferences:
43.13 ms | 401 KiB | 5 Q