Kirmani88 February 2016
Whats is the difference between -> and [''] in php
I have been following 2 ways to get data from an array..sometimes i use
Anytime i have an array, i know 1 of them will work, and it works..
but i am unable to understand what is the difference between them, I am never sure which one to use.
I google it a lot but unable to find any explanation.
Kindly guide me
Gordon February 2016
That's a misconception.
The upper syntax with square brackets will only work for arrays (or objects implementing
The lower syntax using the
T_OBJECT_OPERATOR will only work on objects. You cannot access arrays like that.
Compare the following links in the PHP manual:
Asked in February 2016
Viewed 3,308 times
Answered 1 times
Leave an answer
Quote of the day: live life