On Sat, Sep 21, 2019 at 3:09 PM Kosit Supanyo <webdevxp....@gmail.com>
wrote:

> I understand your point but inconsistency in my sense is syntactical By
> comparing to other declaration syntax like `var`, `static`, 'public` an
> others. They allow only T_VARIABLE but `global` is different. And there's
> another way to archive the same goal through `$GLOBALS`, that's why I see
> it as inconsistency.
>

Even though we're dealing with archeology here - this really isn't an
inconsistency but intended behavior.
Unlike var, public, static and others - 'global' is not a declaration of
class structure, but a way to access global variables.  In the same way it
sometimes makes sense to access variables indirectly ($$foo), it may
sometimes make sense to access global variables indirectly (global $$foo).
It allows for both creation and access of global variables.  It doesn't
sound very useful or practical to provide that ability for the creation of
dynamic class properties, which is why it's not available for
var/public/static/etc.

Zeev

Reply via email to