PHP CompileError

PHPServer Side ProgrammingProgramming

Introduction

In PHP 7.3 onwards, CompileError exception has been added. This class inherits Error class. Some error conditions that previously resulted in fatal error, now throw a CompileError. This affects compilation errors that are likely to be thrown by token_get_all() function.

The token_get_all() function uses Zend lexical scanner to parse a given string into PHP language tokens.

Syntax

token_get_all ( string $source [, int $flags = 0 ] ) : array

Parameters

Sr.NoParameter & Description
1source
PHP source to parse
2flag
TOKEN_PARSE - Recognises the ability to use reserved words in specific contexts.

The function should be used in TOKEN_PARSE mode to be able to raise CompileError.

raja
Published on 21-Sep-2020 15:00:17
Advertisements