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, ), ), null ) );

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.0200.00318.30
8.3.50.0110.00522.03
8.3.40.0070.00718.71
8.3.30.0140.00019.17
8.3.20.0050.00320.34
8.3.10.0040.00422.14
8.3.00.0040.00422.31
8.2.180.0120.00916.88
8.2.170.0040.01122.96
8.2.160.0040.01121.07
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0030.00617.88
8.2.110.0100.00022.19
8.2.100.0060.00617.78
8.2.90.0000.00819.34
8.2.80.0040.00417.97
8.2.70.0030.00717.63
8.2.60.0040.00417.93
8.2.50.0000.00918.07
8.2.40.0060.00318.28
8.2.30.0000.00818.25
8.2.20.0050.00217.79
8.2.10.0000.00717.74
8.2.00.0040.00417.82
8.1.280.0130.00725.92
8.1.270.0070.00023.91
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0050.00523.91
8.1.230.0080.00319.00
8.1.220.0000.00817.76
8.1.210.0050.00318.77
8.1.200.0080.00317.22
8.1.190.0050.00317.50
8.1.180.0030.00518.10
8.1.170.0030.00518.57
8.1.160.0080.00321.98
8.1.150.0040.00418.69
8.1.140.0040.00417.42
8.1.130.0030.00317.79
8.1.120.0030.00517.54
8.1.110.0040.00417.41
8.1.100.0050.00217.52
8.1.90.0040.00417.41
8.1.80.0040.00417.53
8.1.70.0020.00517.38
8.1.60.0060.00317.63
8.1.50.0000.00717.55
8.1.40.0040.00417.62
8.1.30.0040.00417.61
8.1.20.0080.00017.70
8.1.10.0000.00717.64
8.1.00.0040.00417.39
8.0.300.0040.00418.77
8.0.290.0070.00017.43
8.0.280.0030.00318.50
8.0.270.0000.00717.23
8.0.260.0040.00416.89
8.0.250.0070.00017.11
8.0.240.0080.00017.09
8.0.230.0040.00417.07
8.0.220.0000.00816.90
8.0.210.0000.00716.88
8.0.200.0030.00317.07
8.0.190.0080.00017.08
8.0.180.0070.00016.95
8.0.170.0050.00317.02
8.0.160.0000.00717.00
8.0.150.0040.00416.85
8.0.140.0040.00416.96
8.0.130.0060.00013.47
8.0.120.0040.00416.96
8.0.110.0050.00216.96
8.0.100.0040.00416.99
8.0.90.0040.00416.98
8.0.80.0000.01717.05
8.0.70.0040.00416.99
8.0.60.0040.00416.88
8.0.50.0050.00316.88
8.0.30.0070.01617.09
8.0.20.0180.00517.40
8.0.10.0040.00416.95
8.0.00.0090.00916.84
7.4.330.0060.00015.00
7.4.320.0030.00316.56
7.4.300.0030.00316.66
7.4.290.0000.00816.57
7.4.280.0030.00316.45
7.4.270.0000.01116.64
7.4.260.0030.00616.64
7.4.250.0080.00016.58
7.4.240.0000.00816.54
7.4.230.0030.00316.70
7.4.220.0090.00616.52
7.4.210.0080.00516.68
7.4.200.0050.00216.45
7.4.190.0030.00316.61
7.4.160.0110.00416.66
7.4.150.0060.01217.40
7.4.140.0090.01017.86
7.4.130.0110.00616.71
7.4.120.0090.00916.60
7.4.110.0130.00616.54
7.4.100.0160.00316.69
7.4.90.0090.00916.73
7.4.80.0170.00619.39
7.4.70.0100.00716.57
7.4.60.0120.00616.68
7.4.50.0000.00516.82
7.4.40.0080.00822.77
7.4.30.0060.01016.59
7.4.00.0080.01014.96
7.3.330.0030.00313.36
7.3.320.0020.00213.28
7.3.310.0030.00316.45
7.3.300.0070.00016.43
7.3.290.0060.01016.34
7.3.280.0080.01016.34
7.3.270.0080.00917.40
7.3.260.0060.01316.29
7.3.250.0090.00816.63
7.3.240.0080.00916.41
7.3.230.0110.00616.45
7.3.210.0030.01416.38
7.3.200.0130.00619.39
7.3.190.0040.01816.53
7.3.180.0120.00916.58
7.3.170.0080.00816.52
7.3.160.0100.01116.25
7.3.120.0050.01114.74
7.3.110.0040.01415.00
7.3.100.0030.00914.95
7.3.90.0060.00614.74
7.3.80.0030.00715.12
7.3.70.0060.00814.77
7.3.60.0000.00914.91
7.3.50.0120.00314.67
7.3.40.0040.01214.84
7.3.30.0090.00314.91
7.3.20.0080.00816.74
7.3.10.0080.00816.72
7.3.00.0070.00716.80
7.2.330.0100.00716.88
7.2.320.0140.00316.73
7.2.310.0130.00916.77
7.2.300.0100.00716.84
7.2.290.0130.00316.84
7.2.250.0110.00415.05
7.2.240.0070.01414.91
7.2.230.0000.01415.00
7.2.220.0030.01315.00
7.2.210.0100.00314.93
7.2.200.0030.00914.95
7.2.190.0000.00915.09
7.2.180.0090.00615.22
7.2.170.0030.00615.12
7.2.00.0090.00319.25
7.1.330.0110.00415.91
7.1.320.0070.00715.93
7.1.310.0030.00715.92
7.1.300.0030.00615.88
7.1.290.0040.01115.63
7.1.280.0060.00615.78
7.1.270.0070.00715.94
7.1.260.0000.00915.54
7.1.100.0000.01117.97
7.1.70.0040.00417.14
7.1.60.0100.01419.82
7.1.50.0160.00617.05
7.1.00.0030.07722.35
7.0.200.0070.00716.84
7.0.140.0100.06722.09
7.0.100.0200.03319.96
7.0.90.0000.04319.86
7.0.80.0030.04320.02
7.0.70.0000.04320.17
7.0.60.0200.03320.10
7.0.50.0000.04320.40
7.0.40.0030.04020.08
7.0.30.0000.04720.08
7.0.20.0100.03320.01
7.0.10.0030.04020.10
7.0.00.0130.02720.14
5.6.250.0100.04720.68
5.6.240.0070.03320.70
5.6.230.0070.04020.61
5.6.220.0000.04320.68
5.6.210.0130.03320.61
5.6.200.0030.05020.98
5.6.190.0000.03721.07
5.6.180.0030.04020.96
5.6.170.0000.04721.10
5.6.160.0000.03720.96
5.6.150.0030.03321.19
5.6.140.0070.03321.09
5.6.130.0000.03721.05
5.6.120.0100.05720.97
5.6.110.0070.09021.03
5.6.100.0030.04021.02
5.6.90.0000.04721.00
5.6.80.0100.04020.42
5.6.70.0030.07020.36
5.6.60.0070.03720.41
5.6.50.0070.03720.52
5.6.40.0030.04020.41
5.6.30.0070.04020.39
5.6.20.0030.06320.41
5.6.10.0100.05320.48
5.6.00.0100.08020.37
5.5.380.0070.03720.53
5.5.370.0000.03720.38
5.5.360.0030.04020.38
5.5.350.0030.04320.44
5.5.340.0070.04020.95
5.5.330.0070.03720.76
5.5.320.0100.03320.86
5.5.310.0030.04020.82
5.5.300.0030.03720.90
5.5.290.0070.07020.85
5.5.280.0070.04020.92
5.5.270.0100.04020.77
5.5.260.0130.04720.91
5.5.250.0070.08020.77
5.5.240.0070.03720.28
5.5.230.0100.07720.19
5.5.220.0070.03720.21
5.5.210.0000.05320.33
5.5.200.0100.06720.13
5.5.190.0000.04320.27
5.5.180.0070.04320.26
5.5.160.0030.06320.15
5.5.150.0030.06720.25
5.5.140.0070.07720.27
5.5.130.0030.07320.25
5.5.120.0130.03020.25
5.5.110.0030.06720.21
5.5.100.0000.07020.14
5.5.90.0000.08020.19
5.5.80.0070.06320.00
5.5.70.0030.06720.17
5.5.60.0070.03320.14
5.5.50.0030.04720.16
5.5.40.0130.06320.13
5.5.30.0070.07320.07
5.5.20.0030.04020.17
5.5.10.0030.07019.98
5.5.00.0030.07720.13
5.4.450.0070.03319.23
5.4.440.0070.07319.27
5.4.430.0030.04319.41
5.4.420.0070.07019.22
5.4.410.0070.04019.10
5.4.400.0070.07719.17
5.4.390.0100.07318.87
5.4.380.0030.03719.09
5.4.370.0000.07719.16
5.4.360.0030.08319.13
5.4.350.0030.06319.13
5.4.340.0070.03318.95
5.4.320.0130.07019.18
5.4.310.0000.05019.15
5.4.300.0130.07318.94
5.4.290.0030.06018.94
5.4.280.0000.04019.22
5.4.270.0130.06019.10
5.4.260.0130.05719.05
5.4.250.0030.07318.94
5.4.240.0070.05719.20
5.4.230.0000.05019.20
5.4.220.0070.04319.12
5.4.210.0000.04019.15
5.4.200.0070.03319.02
5.4.190.0070.07319.02
5.4.180.0100.07018.83
5.4.170.0200.06718.86
5.4.160.0030.04019.21
5.4.150.0070.03319.14
5.4.140.0070.05716.45
5.4.130.0000.04016.47
5.4.120.0170.06316.33
5.4.110.0070.05716.49
5.4.100.0000.04316.51
5.4.90.0070.07016.46
5.4.80.0000.03716.52
5.4.70.0070.06716.46
5.4.60.0030.05316.37
5.4.50.0170.06016.44
5.4.40.0130.06316.49
5.4.30.0070.06316.36
5.4.20.0100.07316.36
5.4.10.0130.02716.41
5.4.00.0070.07015.94
5.3.290.0030.08014.68
5.3.280.0070.03314.68
5.3.270.0130.06014.65
5.3.260.0100.03714.77
5.3.250.0030.03314.73
5.3.240.0000.04714.71
5.3.230.0030.07314.73
5.3.220.0030.06014.51
5.3.210.0030.03714.52
5.3.200.0070.03014.60
5.3.190.0030.03314.60
5.3.180.0030.05714.67
5.3.170.0070.08314.60
5.3.160.0030.04314.56
5.3.150.0070.07714.51
5.3.140.0030.09014.50
5.3.130.0130.06714.57
5.3.120.0000.08014.50
5.3.110.0070.06014.68
5.3.100.0070.06314.06
5.3.90.0070.04014.10
5.3.80.0000.05314.14
5.3.70.0000.08014.12
5.3.60.0070.04314.16
5.3.50.0030.05013.89
5.3.40.0000.06013.86
5.3.30.0130.05013.91
5.3.20.0070.04313.82
5.3.10.0070.07313.56
5.3.00.0000.07313.72
5.2.170.0030.04011.29
5.2.160.0000.03011.22
5.2.150.0030.03011.10
5.2.140.0070.03011.02
5.2.130.0070.06311.24
5.2.120.0070.05311.23
5.2.110.0030.04711.01
5.2.100.0070.03711.01
5.2.90.0070.02311.02
5.2.80.0000.07011.18
5.2.70.0070.06011.22
5.2.60.0070.05710.98
5.2.50.0130.05311.03
5.2.40.0070.03011.11
5.2.30.0070.04311.13
5.2.20.0030.05310.91
5.2.10.0100.04011.00
5.2.00.0000.06010.60
5.1.60.0030.04310.00
5.1.50.0000.05710.11
5.1.40.0030.04010.06
5.1.30.0030.05010.43
5.1.20.0070.05710.40
5.1.10.0000.02710.09
5.1.00.0070.0509.95
5.0.50.0000.0338.68
5.0.40.0030.0378.53
5.0.30.0000.0578.41
5.0.20.0070.0138.41
5.0.10.0000.0278.41
5.0.00.0000.0578.41
4.4.90.0030.0378.41
4.4.80.0000.0378.41
4.4.70.0030.0208.41
4.4.60.0000.0308.41
4.4.50.0000.0238.41
4.4.40.0000.0438.41
4.4.30.0000.0378.41
4.4.20.0030.0308.41
4.4.10.0000.0308.41
4.4.00.0000.0608.41
4.3.110.0070.0178.41
4.3.100.0070.0308.41
4.3.90.0000.0308.41
4.3.80.0070.0478.41
4.3.70.0000.0308.41
4.3.60.0000.0178.41
4.3.50.0030.0338.41
4.3.40.0000.0538.41
4.3.30.0000.0378.41
4.3.20.0000.0338.41
4.3.10.0000.0338.41
4.3.00.0070.0278.41

preferences:
46.81 ms | 401 KiB | 5 Q