How can “[” be an operator in the PHP language specification?

前端 未结 3 579
萌比男神i
萌比男神i 2021-02-03 17:31

On the http://php.net/manual/en/language.operators.precedence.php webpage, the second highest precedence level contains a left-associative operator called [.

<
3条回答
  •  臣服心动
    2021-02-03 18:31

    It just means the array variable (left associativity - $first) will be evaluated before the array key (right associativity - $second)

    $first[$second]
    

    This have lot of sense when array has multiple dimensions

    $first[$second][$third][$fourth]
    

提交回复
热议问题