PHP, calling static method on class property

前端 未结 2 1538
醉话见心
醉话见心 2021-01-22 12:44

I have a desire to store an object as a property of a class. I then want to be able to call static methods on that class by directly referencing the property.

Consider t

2条回答
  •  暖寄归人
    2021-01-22 12:55

    The error that syntax will give you is:

    Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)


    However it will work in PHP 7 thanks to the Uniform Variable Syntax RFC. All prior versions will require the intermediate variable.

提交回复
热议问题