I've been using PHP quite a while now, but never been an advanced programmer. I feel like this is dumb question but never understood why some array values can be retrieved using different methods:
This:
$array->value
rather than normal:
$array['value']
The standard $array['value'] always works, but the one using the -> method doesn't at times. Why is that?
Here's an example. I am using Zend Framework 2 and I can grab a session value using the -> method:
$this->session->some_value
However, I can't if I do a new, normal array:
$array = array('some_value' => 'myvalue');
$array['some_value']; // works!!
$array->some_value; // does not work :(
In Zend Framework 1 most arrays would work fine this way, and in ZF2 more and more , I run into issues where I need to change the way I get that value. Does this make sense? I sure appreciate any help. Thanks, Greg