PEAR logo

PHP_CompatInfo : The Definitive Guide

Accuracy of detection

PHP_CompatInfo may detect without error and with a great precision, any simple PHP scripts that have no switch conditions such as these ones : function_exists or version_compare.

  1. <?php
  2. // ...
  3. if (function_exists('debug_backtrace')) {
  4.     $backtrace = debug_backtrace();
  5. } else {
  6.     $backtrace = false;
  7. }
  8.  
  9. if (version_compare(phpversion(), '5.0.0', '<')) {
  10.     include_once 'PHP/Compat.php';
  11.     PHP_Compat::loadFunction('ob_get_clean');
  12.     PHP_Compat::loadConstant('PHP_EOL');
  13. }
  14. // ...
  15. ?>

Don't be afraid, PHP_CompatInfo can still be use, even if your PHP scripts have these conditions or any others, but you should help it, to adjust the parser accuracy with one or more options. See the parser options reference list for details and advanced detection section.

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