Hi, I know the both of the above are kinds of arrays which have been retrieved from the database. Why is there 2 different ways to approach it and what's better? Thanks.
No, they are not both arrays. $x['y'] is an array, but $x->y is a variable in a object. You can read more about classes and objects here.