PHP – variable in constructor is empty in other functions of the class

QuestionsPHP – variable in constructor is empty in other functions of the class
Jehal Desai Staff asked 4 years ago

I am trying to access an associative array $foo from a function inside the class. When I log the contents from another function it is empty. I am really unsure what I am doing wrong.

I have also tried another recommendation of using self::$foo but got all sorts of errors about private and static?


View on Stack Overflow