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.
EDIT: reporting is set to E_ALL and only reports this (which is the line that contains the echo statement above):
Notice: Undefined index: parameter in /home/nicolasc/public_html/3rdparty/ecicaps/admin/products-manage.php on line 132
var_dump($environment[0]['parameter']);
outputs NULL
var_dump($environment, $environment[0], $environment[0]['parameter']);
// Outputs
array(12) {
[0]=>
array(3) {
["'parameter'"]=>
string(9) "Vibration"
["'conditions'"]=>
string(3) "204"
["'method'"]=>
string(1) "D"
}
[1]=>
array(3) {
["'parameter'"]=>
string(9) "Immersion"
["'conditions'"]=>
string(3) "104"
["'method'"]=>
string(1) "B"
}
[2]=>
array(3) {
["'parameter'"]=>
string(5) "Shock"
["'conditions'"]=>
string(3) "213"
["'method'"]=>
string(1) "I"
}
[3]=>
array(3) {
["'parameter'"]=>
string(8) "Humidity"
["'conditions'"]=>
string(3) "106"
["'method'"]=>
string(1) "-"
}
[4]=>
array(3) {
["'parameter'"]=>
string(13) "Thermal Shock"
["'conditions'"]=>
string(3) "107"
["'method'"]=>
string(1) "A"
}
[5]=>
array(3) {
["'parameter'"]=>
string(4) "Life"
["'conditions'"]=>
string(3) "108"
["'method'"]=>
string(1) "F"
}
[6]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
[7]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
[8]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
[9]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
[10]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
[11]=>
array(3) {
["'parameter'"]=>
string(0) ""
["'conditions'"]=>
string(0) ""
["'method'"]=>
string(0) ""
}
}
array(3) {
["'parameter'"]=>
string(9) "Vibration"
["'conditions'"]=>
string(3) "204"
["'method'"]=>
string(1) "D"
}
NULL
$environment is populated by form fields ($environment = $_POST['Environment']
)