Documentation

Parser

Table of Contents

parse()  : array<string|int, Stmt>|null
Parses PHP code into a node tree.

Methods

parse()

Parses PHP code into a node tree.

public parse(string $code[, ErrorHandler|null $errorHandler = null ]) : array<string|int, Stmt>|null
Parameters
$code : string

The source code to parse

$errorHandler : ErrorHandler|null = null

Error handler to use for lexer/parser errors, defaults to ErrorHandler\Throwing.

Return values
array<string|int, Stmt>|null

Array of statements (or null non-throwing error handler is used and the parser was unable to recover from an error).

Search results