PHP_CompatInfo::getIgnoredFunctions

PHP_CompatInfo::getIgnoredFunctions() – Returns the latest parse data source ignored functions

Synopsis

require_once 'PHP/CompatInfo.php';

mixed PHP_CompatInfo::getIgnoredFunctions ( mixed $file = false )

Description

Returns the latest parse data source ignored functions list

Parameter

mixed $file

(optional) A specific filename or not (FALSE)

Return value

returns Null on error or if there were no previous data parsing

Throws

throws no exceptions thrown

Since

since version 1.9.0b2 (2008-12-19)

Note

This function can not be called statically.

Example

Suppose we have to parse source code like this file, named "conditional.php" :

<?php
// PHP 4.0.0 : __FILE__
// PHP 4.0.6 : DIRECTORY_SEPARATOR
// PHP 4.0.7 : version compare
// PHP 4.3.0 : ob_get_clean
// PHP 4.3.0 : debug_backtrace
// PHP 4.3.10 and 5.0.2 : PHP_EOL
// PHP 5.0.0 : simplexml_load_file
// PHP 5.1.1 : DATE_W3C

if (!defined('DIRECTORY_SEPARATOR')) {
    
define('DIRECTORY_SEPARATOR',
        
strtoupper(substr(PHP_OS03) == 'WIN') ? '\\' '/'
    
);
}

if (
function_exists('debug_backtrace')) {
    
$backtrace debug_backtrace();
} else {
    
$backtrace false;
}

if (
function_exists('simplexml_load_file')) {
    
$xml simplexml_load_file('C:\php\pear\PHP_CompatInfo\scripts\version.xml');
}

if (
version_compare(phpversion(), '5.0.0''<')) {
    include_once 
'PHP/Compat.php';
    
PHP_Compat::loadFunction('ob_get_clean');
    
PHP_Compat::loadConstant('PHP_EOL');
}

echo 
"Hello World" PHP_EOL;

$ds  DIRECTORY_SEPARATOR;
$fn  dirname(__FILE__) . $ds basename(__FILE__);
echo 
"You have run file : $fn at " date(DATE_W3C) . PHP_EOL;
?>

And this other one, named "ignore_functions_match.php"

<?php
function toFile($filename$data)
{
    if (
function_exists('file_put_contents')) {
        
file_put_contents($filename$data);
    } else {
        
$file fopen($filename'wb');
        
fwrite($file$data);
        
fclose($file);
    }
}

if (
function_exists('debug_backtrace')) {
    
$backtrace debug_backtrace();
} else {
    
$backtrace false;
}

debug_print_backtrace();
?>

Script to parse data source, will look like to:

<?php
require_once 'PHP/CompatInfo.php';

$pci = new PHP_CompatInfo('null');

$dir     dirname(__FILE__) . DIRECTORY_SEPARATOR;
$input   = array($dir 'conditional.php'$dir 'ignore_functions_match.php');
$options = array('ignore_functions_match' => array('preg_match', array('/^debug/')),
                 
'ignore_constants' => array('DIRECTORY_SEPARATOR')
                );

$pci->parseData($input$options);

$functions $pci->getIgnoredFunctions();
echo 
'ALL Ignored Functions = 'implode(','$functions) . PHP_EOL;
$functions $pci->getIgnoredFunctions($input[0]);
echo 
basename($input[0]) . ' ignored functions = 'implode(','$functions) . PHP_EOL;

$extensions $pci->getIgnoredExtensions();
echo 
'ALL Ignored Extensions = 'implode(','$extensions) . PHP_EOL;

$constants $pci->getIgnoredConstants();
echo 
'ALL Ignored Constants = 'implode(','$constants) . PHP_EOL;
?>

We have just used the NULL renderer because we want to organize output results, as below:

ALL Ignored Functions = debug_backtrace,debug_print_backtrace
conditional.php ignored functions = debug_backtrace
ALL Ignored Extensions =
ALL Ignored Constants = DIRECTORY_SEPARATOR
   
Returns list of files ignored (Previous) Returns the latest parse data source ignored extensions (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.