PEAR logo

PHP_CompatInfo : The Definitive Guide

Chapter 11. API - Application Programming Interface

Table of Contents

Parsing data sources
Parser options

Parsing data sources

You can parse multiple data sources :

[Note] Note

API 1.8.0 introduces a common interface to parse all data sources (array, file, directory, chunk of code) with source auto detection. See PHP_CompatInfo::parseData() .

Call one of these five functions, with or without options, and you will retrieve a hash which contains information:

  • ignored_functions, PHP functions list that were ignored during source code parsing.

  • ignored_extensions, PHP extensions list that were ignored during source code parsing.

  • ignored_constants, PHP constants list that were ignored during source code parsing.

  • max_version, maximum PHP version to run source code.

  • version, minimum PHP version to run source code.

  • functions, PHP standard and user functions found in source code.

  • extensions, PHP modules/extensions functions found in source code.

  • constants, PHP constants found in source code.

  • tokens, PHP5 tokens (public, final, abstract, etc )

  • cond_code, A level (and details) of warning about conditional code found during parsing source code: from 0=none, 1=function_exists, 2=extension_loaded, 4=defined

    Its binary value, so 5 means defined+function_exists, and so on ...

PHP_CompatInfo : The Definitive Guide v 1.8.0 : August 1, 2008