Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Chike Mgbemena:
Abstract Syntax Tree/Uniform Variable Syntax in PHP 7+
Nov 01, 2016 @ 16:57:01

Chike Mgbemena has a new post to his site looking at PHP 7 and the abstract syntax tree and uniform variable syntax changes that came along with it.

On my previous post (PHP 7 In-depth Look), I discussed in-depth about the features of PHP 7 (you can read it here if you have not). In this post, I am going to be talking about The Abstract Syntax Tree(AST)/Uniform Variable Syntax in PHP 7+.

PHP 7 introduced a new layer which is called the Abstract Syntax Tree(AST) which helps in decoupling the process of parsing from the pseudo-compile process. Note that this new layer does not have much impact on performance but it make the syntax uniform. Uniform variable syntax/abstract syntax tree aims to establish internally consistent variable syntax, references are accessed from left to right instead of right to left.

He goes on to talk about dereferencing, how it changed from the PHP 5 handling and what IIFEs have to do with it. Some sample code is included showing some of his points and how PHP 7 interprets things slightly different than PHP 7.

tagged: abstractsyntaxtree ast uniform variable syntax php7 php5

Link: http://chikemgbemena.com/2016/11/01/abstract-syntax-treeuniform-variable-syntax-in-php-7/


Trending Topics: