Okay, this seems weird to me!
I have an array with user objects saved in it using the user id as the array key
Array (
[75] => pwUser Object
(
[data:protected] => Array
(
[ID] => 75
[display_name] => Chris Waa
)
)
[1] => pwUser Object
(
[data:protected] => Array
(
[ID] => 1
[display_name] => Alex Müller
)
)
)
I now want to access this array with the following code
$this->users[$notification['subscribeNotID']]->getAvatar()
But I'm receiving an error
Notice: Undefined index: in NotificationList.class.php on line 217
Fatal error: Call to a member function getAvatar() on a non-object in NotificationList.class.php on line 217
Okay, let's var_dump $notification['subscribeNotID']
string(2) "75"
The key 75 is definitely available in the array! Curiously, the script works like that
$ID = "75"; // var_dump() returns the same as $notification["subscribeNotID"] above
$this->users[$ID]->getAvatar()
Why?