I'm using PHP-Parser to build the AST. Then I want to reach the index of Global variables such as $_POST['firstname']
, so I want to reach the index firstname
and get it. How to reach the index of global variables, for example;
test
<?php
$nameValue = $_POST['firstname'];
?>
AST Result:
array( 0: Stmt_Expression( expr: Expr_Assign( var: Expr_Variable( name: nameValue ) expr: Expr_ArrayDimFetch( var: Expr_Variable( name: _POST ) dim: Scalar_String( value: firstname ) ) ) ) )
So how to reach the index firstname
and store it in variable?