Unable to access value of nested array element
- by John Conde
I'm having an issue getting the value of a nested array element. Here's what I've got:
print_r($environment);
// Outputs
Array
(
[0] => Array
(
['parameter'] => Vibration
['conditions'] => 204
['method'] => D
)
[1] => Array
(
['parameter'] => Immersion
['conditions'] => 104
['method'] => B
)
[2] => Array
(
['parameter'] => Shock
['conditions'] => 213
['method'] => I
)
[3] => Array
(
['parameter'] => Humidity
['conditions'] => 106
['method'] => -
)
)
print_r($environment[0]);
// Outputs
Array
(
['parameter'] => Vibration
['conditions'] => 204
['method'] => D
)
echo $environment[0]['parameter'];
// Nothing
Maybe I've been looking at this for too long. Any ideas would be greatly appreciated.