Parsing PHP and return a AST of the code

Code
<?php

use PhpParser\ParserFactory;

$parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP5);

$php '<?php echo "Hello budgies"; if (true) { echo "true"; }';

$parsed $parser->parse($php);

Zend\Debug\Debug::dump($parsed);
Result
array(2) {
  [0] => object(PhpParser\Node\Stmt\Echo_)#367 (2) {
    ["exprs"] => array(1) {
      [0] => object(PhpParser\Node\Scalar\String_)#371 (2) {
        ["value"] => string(13) "Hello budgies"
        ["attributes":protected] => array(3) {
          ["startLine"] => int(1)
          ["endLine"] => int(1)
          ["kind"] => int(2)
        }
      }
    }
    ["attributes":protected] => array(2) {
      ["startLine"] => int(1)
      ["endLine"] => int(1)
    }
  }
  [1] => object(PhpParser\Node\Stmt\If_)#359 (5) {
    ["cond"] => object(PhpParser\Node\Expr\ConstFetch)#360 (2) {
      ["name"] => object(PhpParser\Node\Name)#369 (2) {
        ["parts"] => array(1) {
          [0] => string(4) "true"
        }
        ["attributes":protected] => array(2) {
          ["startLine"] => int(1)
          ["endLine"] => int(1)
        }
      }
      ["attributes":protected] => array(2) {
        ["startLine"] => int(1)
        ["endLine"] => int(1)
      }
    }
    ["stmts"] => array(1) {
      [0] => object(PhpParser\Node\Stmt\Echo_)#357 (2) {
        ["exprs"] => array(1) {
          [0] => object(PhpParser\Node\Scalar\String_)#355 (2) {
            ["value"] => string(4) "true"
            ["attributes":protected] => array(3) {
              ["startLine"] => int(1)
              ["endLine"] => int(1)
              ["kind"] => int(2)
            }
          }
        }
        ["attributes":protected] => array(2) {
          ["startLine"] => int(1)
          ["endLine"] => int(1)
        }
      }
    }
    ["elseifs"] => array(0) {
    }
    ["else"] => NULL
    ["attributes":protected] => array(2) {
      ["startLine"] => int(1)
      ["endLine"] => int(1)
    }
  }
}
Used Versions
PHP 7.1, Zend 3.0, Symfony 3.2, Laravel 5.2, PHPUnit 5.6, Doctrine 2.6