You can check if the variable is static through Reflection:
class Foo { static $bar; } $prop = new ReflectionProperty('Foo', 'bar'); var_dump($prop->isStatic());
However, this still will not allow you to use them with the magic methods __get or __set , because they work only in the context of the object. From the PHP manual on magic methods:
Property overloading only works in the context of an object. These magic methods will not be triggered in a static context. Therefore, these methods should not be declared static. Starting with PHP 5.3.0, a warning is issued if one of the overload magic methods is declared static.
Also check out this discussion on the PHP Internals mailing list about introducing __getStatic :
source share