Question about `global` variable declaration
| From: | Kosit Supanyo | Date: | Sat, 21 Sep 2019 09:55:50 +0000 |
| Subject: | Question about `global` variable declaration | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-107274@lists.php.net to get a copy of this message | ||
Hi Internals
I'm working on my new proposals and I've found weirdness of global variable
declaration in zend_language_parser.y.
global_var:
simple_variable
{ $$ = zend_ast_create(ZEND_AST_GLOBAL,
zend_ast_create(ZEND_AST_VAR, $1)); }
;
Above grammer allows something like this...
global $$x;
global $$$y;
global $$$$z;
global ${'abc'};
global $$$$$$$$$${random_int(0, PHP_INT_MAX)};
What's the propose of allowing this? And is there anyone out there knowing
and using it? If not, should this be changed to allow only T_VARIABLE to
make it consistent with
static variable declaration?
Regards