I have an array $attribGarden which looks like this:
array(3) {
[0]=>
array(2) {
["property"]=>
array(3) {
["typeKind"]=>
string(9) "isolation"
["typeId"]=>
int(76)
["valueId"]=>
string(3) "386"
}
["children"]=>
array(2) {
[0]=>
array(2) {
["property"]=>
array(3) {
["typeKind"]=>
string(9) "isolation"
["typeId"]=>
int(79)
["valueId"]=>
string(3) "395"
}
....
....
....
Also I have a function on the same page:
function ____storeAttribGarden($data, $parent = 0){
foreach($data as $value){
if($value['property']['typeKind'] == 'isolation'){
// some action here
}
}
}
When the code executes, it's throwing this error:
Undefined index: property in E:\xyz\proc_product.php on line 1743
// line 1743 refers to the if() condition of the function
I tried print_r(array_keys($value)); just before the if condition, and got the following output:
Array
(
[0] => property
[1] => children
)
The print_r($value) gives this:
Array
(
[property] => Array
(
[typeKind] => isolation
[typeId] => 76
[valueId] => 386
)
[children] => Array
(
[0] => Array
(
[property] => Array
(
[typeKind] => isolation
[typeId] => 79
[valueId] => 395
)
So it's clear that there is an index called 'property' in the array. But the function does not recognise it. What could be the problem? Am I doing anything wrong here?
Thanks for your time.
var_dump, which gives you more info, like the string length. Make sure there are no invisible characters in there.array_keys($value).property?