Parser

The PHP parser is a piece of software that process a piece of text and extract tokens, with their PHP meanings. The tokens are atomic pieces of information, that are grouped later to build a larger message.

PHP includes an internal parser, that reads the source code, and produces the PHP tokens, the AST and later, the opcodes.

<?php

    if (!json_validate($json)) {
        throw new Exception('invalid JSON data');
    }

    $object = json_decode($json);

?>

Documentation

See also Parse, don’t validate and tree-sitter-language-pack.

Related : Sanitation, Validation, Parse, ParseError, Sandbox

Related packages : nikic/PHP-Parser, parsica-php/parsica