This example show how to parse a single file and detect php minimum version and extensions needed to run it.
This example requires mandatory resources :
math.php : the source file php code to parse
The very basic script to parse the file
array (
'ignored_files' =>
array (
),
'ignored_functions' =>
array (
),
'ignored_extensions' =>
array (
),
'ignored_constants' =>
array (
),
'max_version' => '',
'version' => '4.0.0',
'extensions' =>
array (
0 => 'bcmath',
1 => 'pcre',
),
'constants' =>
array (
),
'tokens' =>
array (
),
'cond_code' =>
array (
0 => 0,
),
)
At line 6, we created a basic instance of PHP_CompatInfo without parameters. That means, we used the default Array renderer (see Output). Results are always displayed on Standard Output unless you use the Null Renderer.
Offset 0 of cond_code in results, tell us that PHP_CompatInfo has not found any conditional code (=0). So be sure that the result of version and extensions are TRUE
Finally, we can tell that math.php need PHP 4.0.0 (minimum) and bcmath + pcre extensions to run.