PHP: Is it possible to use a static variable defined earlier in the same class definition?

I have a php class like the following and got error saying invalid operation. I tried Sell::$a, self::$a and $this->a, Foo::$a, none of them worked. So I'm wondering if it's possible with PHP. I'm using php7.1. With Perl, there'd be no problems.
<?php
class Foo {
public static $a = 1;
public static $b = $a; /* want to assign $a to $b here */
...
}
Answer
Solution:
No, you can't, since PHP supports static initialization with literals and const expression.
You can't even use__get
since
Member overloading only works in object context. These magic methods will not be triggered in static context. Therefore these methods can not be declared static.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illegal string offset
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.