Strange my research has not turned'up this exact scenario:
$someVar = $this->StaticClassName::$staticClassProperty;
php 7.* happily accesses the property but 5.6.* (.11 in this case) falls over with the error:
unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM)
And yes, I've tried every ${permutation}:: I could think of.
There's a lot of compound expressions like this which don't work in PHP 5. Usually the solution is to break it into multiple expressions, and you can do that here:
$className = $this->StaticClassName;
$someVar = $className::$staticClassProperty;
This works on both PHP 5 and PHP 7.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With