I frequently see $var->another_var
, or $somevar=>yet_another
, or even $third_var->another=>$fourth_var
in various snippets of code.
Is there some super amazing info-graphic somewhere that clearly explains the various usages and what they mean, specifically within a PHP context?
(In my case, using Drupal, which uses LOTS of arrays, but probably useful in lots of other CMSs / frameworks.)
EDIT: I have since been informed about a catch-all page that has a very useful, encyclopedic list of various symbols and syntaxes. However, I believe one section NOT covered there is the mix-and-match combo of $var->element=>$anothervar.
$var->another_var
is "property another_var
of object referenced by $var
".
$somevar=>yet_another
is used in array definitions, like this: $arr = array($somevar => yet_another)
. It would define an associative property with key equal to the value of variable $somevar
, and value equal to the constant yet_another
.
$third_var->another=>$fourth_var
can be rewritten so it becomes more clear:
array( /*key=*/ ($third_var->another) => /*value=*/ $fourth_var )`