I have an object and when I user var_dump i get the following:
var_dump($object);
array (size=7)
'id' => int 1969
'alt' => string '' (length=0)
'title' => string 'File Name' (length=9)
'url' => string 'http://location/file.pdf' (length=24)
When I echo $object[url] it returns string 'http://location/file.pdf' (length=24), however when I echo $object->url I get null. (This sometimes works for extracting values from an array, I'm just not sure in which cases or what type of arrays)
The problem is that I use a hosting provider that has a git feature, and when I push my changes, it checks the PHP code and encounters a syntax error (unexpected '[') which halts the push.
My local server uses PHP 5.4.16 and the host uses 5.3.2
On a broader note, can someone point me to a resource that explains the difference between these two methods of extracting values from arrays? Much appreciated!
$var->foois an object reference.$var[foo]is an array reference. While this sort of thign could be used interchangeably in some languages like javascript, in PHP an array and an object are two entirely different things.