I have built an array as follows:
while($row = mysqli_fetch_array($result))
{
$universe[] = $row;
}
The print_r output is as follows:
Array ( [0] =>
Array ( [0] => 1 [ID] => 1 [1] => Russian Federation - Conventional [Misc1] => Russian Federation - Conventional [2] => RUS.Con1 [Misc2] => RUS.Con1 [3] => [Misc3] => [4] => [Misc4] => [5] => 13.13 [1980] => 13.13 [1981] => 13.13 [1982] => 13.13 [1983] => 13.13 [1984] => 13.13 [1985] => 13.13 [1986] => 13.13)
[1] =>
Array ( [0] => 2 [ID] => 2 [1] => Saudi Arabia - Conventional [Misc1] => Saudi Arabia - Conventional [2] => SAU.Con1 [Misc2] => SAU.Con1 [3] => [Misc3] => [4] => [Misc4] => [5] => 4.47 [1980] => 4.47 [1981] => 4.47 [1982] => 4.47 [1983] => 4.47 [1984] => 4.47 [1985] => 4.47 [1986] => 4.47 ) etc ...
I am now trying to get an array of all values in column [1980].. So I do the following, but get a blank. Any ideas? Also -why am I getting an unecessary array wrapping everything?
print_r($universe);
$hi = array_column($universe, '1980');
print_r($hi);
PHP >= 5.5. What PHP version do you use?... [3] => [Misc3] => [4] => [Misc4] => [5] => 13.13...? This is not php... of course every one is free to do what they want and not everyone has high standards but such a sloppy code feels disrepectful towards the people you ask for help.