I'm trying to set a private variable array on my class. But I'm getting an error. Is this even possible? In other words, can I define a variable with a key - or is it bad practice?
class SomeClass { private $result['results'] = array(); .... Error: Parse error: syntax error, unexpected '[', expecting ',' or ';'
resultsarray. I just need to access this in a separate method, so wanted to set it as a class variable.private $result = array();If you want to add sub arrays fo rit when you need them