Initialising a static variable in PHP

后端 未结 3 963
野趣味
野趣味 2021-01-22 14:42

Taken from the PHP manual:

Like any other PHP static variable, static properties may only be initialized using a literal or constant; expressions are no

3条回答
  •  青春惊慌失措
    2021-01-22 15:07

    Because an array is not a function.

    While array(1,2) looks like you are calling a function that is called array, you are doing none of the sorts. You are just making an array, which is not a function call. it is closer to saying $a = 1.

提交回复
热议问题