I often see that in the source code of open projects there is a second option. Is there a difference between them? If not, is the use of this or that option a question of taste?

  • in the `$ array-> var` variant, probably an array is also an arrow from something else, such as $News->$array->var and then this is a question for the OOP .... just $array['var'] - an array not related to the class ....... without a class you cannot write $array->var - Alexey Shimansky

1 answer 1

$array['var'] - a call to the var element of the $ array

$array->var - a call to the var property of the object $ array

In PHP, objects and arrays have a difference. In JS, for example, they don’t have - any operators will go down there