I've been getting error from accessing array with string offsets. The array looks something like this:
$array = array(
"first" => array("one","two","three"),
"second" => array("blabla"),
"third" => array("something","else"),
"fourth" => array("next","nextnext","nextnextnext")
);
I'm trying to get one of the inside arrays depending on string I have and I use that string as offset, like this:
$curArray = $array[$this->string];
But everytime I run the script I get an error on that line. Can you please tell me why? The error I get is "Illegal offset type". Thanks
$this? What is$this->string?$curArray = $array["third"];$this->stringreffers to value of $string property of the objectvar_dump($this->string);and check what it containsobject(SimpleXMLElement)#7 (1) { [0]=> string(3) "second" }