array|false PHP_CompatInfo::parseArray (
array $files
, array $options = array()
)
ファイルあるいは文字列の配列をパースします。文字列をパースするには、 $options['is_string'] を true に設定しなければなりません。
$files
ファイル名あるいはコードを含む文字列の配列。
$options
以下のオプションを指定する配列。
file_ext には PHP コードとみなるファイル拡張子の配列を指定します。 デフォルトは php, php4, inc, phtml です。
debug には、追加の出力を行うかどうかを boolean 値で指定します。
ignore_functions には、バージョンを算出する際に無視させたい関数の配列を指定します。
ignore_constants には、バージョンを算出する際に無視させたい定数の配列を指定します。
ignore_files には、無視させたいファイルの配列を指定します。 ファイル名の大文字小文字は区別しません。
is_string には、配列の内容が文字列とファイル名のどちらであるかを boolean 値で指定します。
ignore_extensions には、バージョンを算出する際に無視させたい PHP 拡張モジュールの配列を指定します。
ignore_versions には、バージョンを算出する際に無視させたい PHP のバージョンの配列を指定します。
ignore_functions_match には、バージョンを算出する際に無視させたい関数名のパターンの配列を指定します。
ignore_extensions_match には、バージョンを算出する際に無視させたい拡張モジュール名のパターンの配列を指定します。
ignore_constants_match には、バージョンを算出する際に無視させたい定数名のパターンの配列を指定します。
例外はスローされません。
PHP_CompatInfo::parseData() も参照ください。
バージョン 0.7.0 (2004-03-09) 以降
This function can not be called statically.
array - 以下のキーを含むハッシュを返します。
ignored_functions
,
ignored_extensions
,
ignored_constants
,
max_version
,
version
,
extensions
,
constants
,
tokens
,
cond_code
<?php
require_once 'PHP/CompatInfo.php';
$pci = new PHP_CompatInfo();
$input = array('/opt/lampp/etc/pear/PEAR.php',
'/opt/lampp/etc/pear/PHP/CompatInfo.php');
$res = $pci->parseArray($input);
var_export($res);
?>
結果はこのようになります。
array ( 'ignored_files' => array ( ), 'ignored_functions' => array ( ), 'ignored_extensions' => array ( ), 'ignored_constants' => array ( ), 'max_version' => '', 'version' => '4.3.0', 'extensions' => array ( 0 => 'sapi_cgi', 1 => 'pcre', 2 => 'tokenizer', ), 'constants' => array ( ), 'tokens' => array ( ), 'cond_code' => array ( 0 => 7, 1 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), ), ), '/opt/lampp/etc/pear/PEAR.php' => array ( 'ignored_functions' => array ( ), 'ignored_extensions' => array ( ), 'ignored_constants' => array ( ), 'max_version' => '', 'version' => '4.3.0', 'extensions' => array ( 0 => 'sapi_cgi', ), 'constants' => array ( ), 'tokens' => array ( ), 'cond_code' => array ( 0 => 7, 1 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), ), ), ), '/opt/lampp/etc/pear/PHP/CompatInfo.php' => array ( 'ignored_functions' => array ( ), 'ignored_extensions' => array ( ), 'ignored_constants' => array ( ), 'max_version' => '', 'version' => '4.3.0', 'extensions' => array ( 0 => 'pcre', 1 => 'tokenizer', ), 'constants' => array ( ), 'tokens' => array ( ), 'cond_code' => array ( 0 => 0, 1 => array ( 0 => array ( ), 1 => array ( ), 2 => array ( ), ), ), ), )
parseDir() と同様、まず全体的な結果を出力してから $input の各エントリについての詳細を返します。
$input のエントリは、すべてファイルであるかすべて文字列 (PHP コード片) であるかのいずれかです。文字列とファイルを共存させることはできません。