I'm getting:
Notice: Undefined offset: 0
in my code, however I can print_r the element I am trying to get and its clearly defined.
function get_members($entries_found) {
$members = $entries_found[0]['member'];
...
}
If I print_r($members) I get the expected output, however I'm still getting the Notice.
Any clues?
I don't really know what happens with your
$entries_found
before accessing it fromget_members
But i had the same problem.
print_r
andvar_dump
showed me, that the index exists but when i tried to access it i got theoffset error
In my case i decoded a json string with
json_decode
without setting theassoc
flag.Got my solution from here: Undefined offset while accessing array element which exists
Do
To check that the array does indeed have an offset of zero. Other things you can try would be reseting the array pointer
of checking if it's set first
If all else fails you could just supress the notice with