3v4l.org

run code in 300+ PHP versions simultaneously
<?php if(!function_exists('is_assoc')){ function is_assoc($array) { return (bool)count(array_filter(array_keys($array), 'is_string')); } } /** * getCols * * Takes an array of associative arrays and combines them to get * the columns * * @author Joe Richardson * @access public * @return object Instance of DB or Null */ function getCols(array $data, $col = null) { if(is_assoc($data)){ $d = $data; }else{ $d = (array)call_user_func_array('array_merge_recursive',$data); } return ($col === null)?$d:$d[$col]; } $a = array( array( 'id' => 1 , 'name' => 'foo' , 'date' => date('m-d-Y') ) , array( 'id' => 2 , 'name' => 'bar' , 'date' => date('m-d-Y') ) , array( 'id' => 3 , 'name' => 'george' , 'date' => date('m-d-Y') ) , array( 'id' => 4 , 'name' => 'burdell' , 'date' => date('m-d-Y') ) ); if(function_exists('array_columns')) { echo('array_columns'); $b = array_columns($a, 'name'); }else { echo('getCols'); $b = getCols($a, 'name'); } var_dump($b);

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.0170.00416.62
8.3.50.0070.01222.07
8.3.40.0110.00419.01
8.3.30.0080.00619.21
8.3.20.0070.00020.21
8.3.10.0040.00423.48
8.3.00.0050.00319.51
8.2.180.0070.00718.42
8.2.170.0030.01222.96
8.2.160.0150.00020.52
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0150.00026.16
8.2.120.0050.00322.11
8.2.110.0090.00022.20
8.2.100.0030.00917.91
8.2.90.0040.00419.34
8.2.80.0030.00618.05
8.2.70.0000.01317.49
8.2.60.0050.00318.16
8.2.50.0040.00418.07
8.2.40.0030.00518.28
8.2.30.0030.00618.10
8.2.20.0030.00517.75
8.2.10.0070.00018.21
8.2.00.0040.00417.84
8.1.280.0170.00325.92
8.1.270.0130.00322.20
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00623.82
8.1.230.0040.00719.16
8.1.220.0050.00317.91
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0000.00917.64
8.1.180.0050.00318.10
8.1.170.0000.00918.69
8.1.160.0060.00622.04
8.1.150.0040.00418.67
8.1.140.0030.00517.64
8.1.130.0000.00717.86
8.1.120.0040.00417.67
8.1.110.0040.00417.53
8.1.100.0030.00317.58
8.1.90.0040.00417.54
8.1.80.0030.00617.69
8.1.70.0040.00417.54
8.1.60.0040.00417.51
8.1.50.0040.00417.51
8.1.40.0080.00017.45
8.1.30.0050.00317.67
8.1.20.0040.00417.57
8.1.10.0030.00517.53
8.1.00.0030.00617.68
8.0.300.0030.00318.77
8.0.290.0040.00417.16
8.0.280.0080.00018.58
8.0.270.0000.00717.27
8.0.260.0070.00017.04
8.0.250.0070.00017.15
8.0.240.0040.00417.11
8.0.230.0030.00317.06
8.0.220.0030.00316.98
8.0.210.0030.00316.91
8.0.200.0000.00617.00
8.0.190.0070.00417.11
8.0.180.0000.00816.95
8.0.170.0030.00516.99
8.0.160.0000.00816.93
8.0.150.0080.00016.87
8.0.140.0040.00416.89
8.0.130.0030.00313.39
8.0.120.0060.00316.97
8.0.110.0040.00416.98
8.0.100.0040.00416.78
8.0.90.0080.00016.85
8.0.80.0040.01117.04
8.0.70.0040.00417.00
8.0.60.0020.00516.93
8.0.50.0030.00516.99
8.0.30.0110.00917.38
8.0.20.0090.01117.40
8.0.10.0000.00717.13
8.0.00.0120.00717.02
7.4.330.0000.00515.16
7.4.320.0000.00616.64
7.4.300.0000.00616.70
7.4.290.0030.00316.70
7.4.280.0030.00316.48
7.4.270.0000.00816.54
7.4.260.0030.00316.55
7.4.250.0000.00716.57
7.4.240.0040.00416.62
7.4.230.0060.00316.77
7.4.220.0090.00916.69
7.4.210.0080.00916.72
7.4.200.0070.00016.79
7.4.190.0030.00516.83
7.4.160.0090.00916.70
7.4.150.0100.01017.40
7.4.140.0160.00517.86
7.4.130.0130.00816.68
7.4.120.0130.00516.59
7.4.110.0100.01016.73
7.4.100.0090.00916.55
7.4.90.0110.00716.62
7.4.80.0080.01119.39
7.4.70.0100.00716.70
7.4.60.0120.00916.63
7.4.50.0000.00816.70
7.4.40.0130.00022.77
7.4.30.0080.00816.65
7.4.00.0000.01515.12
7.3.330.0000.00513.32
7.3.320.0030.00313.24
7.3.310.0030.00316.43
7.3.300.0030.00316.30
7.3.290.0060.01316.35
7.3.280.0060.01116.38
7.3.270.0130.00317.40
7.3.260.0170.00316.60
7.3.250.0120.01116.54
7.3.240.0110.01116.61
7.3.230.0090.00916.46
7.3.210.0160.00316.58
7.3.200.0130.00819.39
7.3.190.0090.00916.49
7.3.180.0070.01016.66
7.3.170.0080.01316.61
7.3.160.0130.00316.51
7.3.120.0080.00615.17
7.3.110.0090.00614.89
7.3.100.0110.00314.93
7.3.90.0110.00414.80
7.3.80.0070.00414.75
7.3.70.0060.00614.93
7.3.60.0060.00914.94
7.3.50.0060.00614.67
7.3.40.0090.00614.84
7.3.30.0030.01414.75
7.3.20.0030.01416.86
7.3.10.0040.01116.78
7.3.00.0030.00616.81
7.2.330.0060.01116.89
7.2.320.0090.01216.70
7.2.310.0100.01316.77
7.2.300.0100.00816.70
7.2.290.0100.01316.81
7.2.240.0120.00315.47
7.2.230.0000.01615.22
7.2.220.0070.00315.28
7.2.210.0070.01115.26
7.2.200.0100.00715.32
7.2.190.0090.00615.12
7.2.180.0000.01615.28
7.2.170.0150.00014.96
7.2.160.0060.00915.05
7.2.150.0070.01117.10
7.2.140.0030.00916.86
7.2.130.0040.00716.98
7.2.120.0070.01117.09
7.2.110.0080.00317.13
7.2.100.0070.01017.03
7.2.90.0100.00317.05
7.2.80.0070.01117.13
7.2.70.0080.00817.21
7.2.60.0050.00917.04
7.2.50.0090.00517.02
7.2.40.0070.00717.16
7.2.30.0070.01017.14
7.2.20.0100.00316.85
7.2.10.0130.00317.02
7.2.00.0030.01016.95
7.1.330.0070.00715.80
7.1.320.0030.01416.05
7.1.310.0040.01215.79
7.1.300.0000.01515.96
7.1.290.0000.01115.93
7.1.280.0000.01815.89
7.1.270.0000.00915.67
7.1.260.0030.01015.94
7.1.250.0060.00915.93
7.1.200.0090.00315.91
7.1.70.0030.01017.41
7.1.60.0120.01219.33
7.1.50.0130.02035.09
7.1.00.0030.07722.42
7.0.200.0120.00616.93
7.0.140.0030.07021.97
7.0.90.0600.07719.88
7.0.80.0270.07719.88
7.0.70.0030.05019.84
7.0.60.0070.07719.81
7.0.50.0070.04720.27
7.0.40.0170.07020.10
7.0.30.0130.06320.12
7.0.20.0070.04720.11
7.0.10.0130.05720.13
7.0.00.0130.06320.04
5.6.240.0170.07720.67
5.6.230.0130.05720.63
5.6.220.0000.05720.44
5.6.210.0130.07020.50
5.6.200.0100.06721.14
5.6.190.0070.07321.11
5.6.180.0100.03721.08
5.6.170.0100.04321.02
5.6.160.0070.07721.02
5.6.150.0030.04720.96
5.6.140.0130.04321.17
5.6.130.0170.07321.02
5.6.120.0170.06721.11
5.6.110.0030.05021.04
5.6.100.0070.07320.95
5.6.90.0100.06320.94
5.6.80.0100.08320.43
5.6.70.0070.05020.49
5.6.60.0070.05720.41
5.6.50.0070.08320.35
5.6.40.0170.07320.39
5.6.30.0130.05720.38
5.6.20.0100.07320.44
5.6.10.0100.07020.41
5.6.00.0100.07320.28
5.5.380.0030.08720.41
5.5.370.0300.02720.40
5.5.360.0130.07020.32
5.5.350.0030.07720.28
5.5.340.0100.05020.89
5.5.330.0070.08720.84
5.5.320.0070.05720.77
5.5.310.0070.06020.90
5.5.300.0130.07720.65
5.5.290.0130.05720.93
5.5.280.0100.07320.89
5.5.270.0000.08320.92
5.5.260.0070.08320.79
5.5.250.0030.07720.68
5.5.240.0070.08020.29
5.5.230.0070.04020.27
5.5.220.0030.06320.25
5.5.210.0170.06020.02
5.5.200.0100.07020.13
5.5.190.0070.05320.13
5.5.180.0130.03020.24
5.5.160.0200.07320.23
5.5.150.0170.07320.18
5.5.140.0030.04020.25
5.5.130.0100.04020.21
5.5.120.0100.06720.18
5.5.110.0200.06020.25
5.5.100.0070.07020.12
5.5.90.0070.05720.10
5.5.80.0070.06320.07
5.5.70.0100.08020.09
5.5.60.0130.06720.10
5.5.50.0070.05320.02
5.5.40.0030.04019.96
5.5.30.0100.07020.05
5.5.20.0100.06320.15
5.5.10.0100.08020.12
5.5.00.0030.04320.10
5.4.450.0100.07719.24
5.4.440.0030.04319.32
5.4.430.0100.05319.55
5.4.420.0100.04719.40
5.4.410.0000.08019.14
5.4.400.0100.06719.10
5.4.390.0070.06319.23
5.4.380.0200.04319.14
5.4.370.0100.07019.04
5.4.360.0170.03718.88
5.4.350.0100.03719.20
5.4.340.0070.03719.18
5.4.320.0070.07019.18
5.4.310.0100.03318.89
5.4.300.0030.08019.16
5.4.290.0100.06318.84
5.4.280.0070.07019.02
5.4.270.0070.04018.87
5.4.260.0100.04018.90
5.4.250.0130.03318.89
5.4.240.0000.05719.15
5.4.230.0070.06319.12
5.4.220.0070.06019.15
5.4.210.0070.07319.12
5.4.200.0000.04718.90
5.4.190.0030.07718.87
5.4.180.0170.06018.84
5.4.170.0170.06019.04
5.4.160.0070.04719.11
5.4.150.0100.07718.80
5.4.140.0100.07016.47
5.4.130.0070.04016.51
5.4.120.0030.05016.52
5.4.110.0030.06716.33
5.4.100.0130.06316.45
5.4.90.0100.07016.56
5.4.80.0100.06316.55
5.4.70.0070.04016.52
5.4.60.0070.03316.32
5.4.50.0030.04016.44
5.4.40.0030.04316.46
5.4.30.0030.04316.25
5.4.20.0070.07316.31
5.4.10.0100.07316.29
5.4.00.0030.06315.89
5.3.290.0200.06014.68
5.3.280.0130.03314.62
5.3.270.0100.03314.64
5.3.260.0030.06014.68
5.3.250.0070.07014.69
5.3.240.0070.05014.75
5.3.230.0070.07314.70
5.3.220.0070.04314.67
5.3.210.0100.07014.64
5.3.200.0070.05014.71
5.3.190.0030.08014.53
5.3.180.0230.06014.60
5.3.170.0100.07014.71
5.3.160.0000.04314.71
5.3.150.0000.04014.56
5.3.140.0070.07714.63
5.3.130.0030.06714.49
5.3.120.0030.05714.62
5.3.110.0100.08014.52
5.3.100.0100.07314.01
5.3.90.0100.05714.13
5.3.80.0070.04013.95
5.3.70.0030.08014.14
5.3.60.0100.04314.08
5.3.50.0130.05313.96
5.3.40.0030.04313.96
5.3.30.0030.03713.80
5.3.20.0030.07313.86
5.3.10.0100.05713.65
5.3.00.0100.06713.71
5.2.170.0030.06711.07
5.2.160.0100.05311.26
5.2.150.0070.03711.20
5.2.140.0130.03711.21
5.2.130.0030.04011.06
5.2.120.0030.04711.03
5.2.110.0000.07011.02
5.2.100.0100.05711.20
5.2.90.0000.03310.96
5.2.80.0030.06011.13
5.2.70.0070.03711.20
5.2.60.0100.04710.95
5.2.50.0030.06311.09
5.2.40.0030.05711.11
5.2.30.0070.05711.03
5.2.20.0030.06010.98
5.2.10.0030.03310.93
5.2.00.0030.03010.82
5.1.60.0000.03010.28
5.1.50.0030.05010.28
5.1.40.0030.03710.28
5.1.30.0030.05310.28
5.1.20.0070.03010.48
5.1.10.0100.02710.28
5.1.00.0000.06010.28
5.0.50.0000.03710.28
5.0.40.0030.04010.28
5.0.30.0030.05310.28
5.0.20.0030.03310.28
5.0.10.0070.04010.28
5.0.00.0070.06010.28
4.4.90.0000.01710.28
4.4.80.0100.01010.28
4.4.70.0100.03010.28
4.4.60.0030.01710.28
4.4.50.0030.01710.28
4.4.40.0000.05710.28
4.4.30.0000.03310.28
4.4.20.0030.03310.28
4.4.10.0000.03710.28
4.4.00.0000.05310.28
4.3.110.0000.02710.28
4.3.100.0000.02010.28
4.3.90.0000.02010.28
4.3.80.0000.05310.28
4.3.70.0070.03010.28
4.3.60.0030.03310.28
4.3.50.0030.03310.28
4.3.40.0000.03710.28
4.3.30.0030.03010.28
4.3.20.0070.03010.28
4.3.10.0000.03710.28
4.3.00.0000.03310.28

preferences:
53.82 ms | 401 KiB | 5 Q