PHP_Compat::loadVersion

PHP_Compat::loadVersion() – Load all components, or all components until a given version of PHP

Synopsis

require_once 'PHP/Compat.php';

array PHP_Compat::loadVersion ( string $version )

Description

Load all components, or all components until a given version of PHP.

Parameter

string $version

The version of PHP to load components until.

Return value

array

  • An associative array of boolean values. The key is the name of the component loaded. The value for whether or not the component was loaded correctly.

Example

Loading all components:

<?php
require_once 'PHP/Compat.php';
$components PHP_Compat::loadVersion();

// To see which components were loaded
print_r($components);
?>

This example would show a long list of components which were loaded.

Loading up to a specific version:

The components loaded would be those with versions lower than, or equal to the supplied version and greater than the current PHP version.

<?php
require_once 'PHP/Compat.php';
$components PHP_Compat::loadVersion('4.3.0');

// To see which components were loaded
print_r($components);
?>

This would output an array of components which were loaded. The output would be simular to:


Array
(
    [array_diff_assoc] => 1
    [file_get_contents] => 1
    [get_include_path] => 1
    [html_entity_decode] => 1
    [image_type_to_mime_type] => 1
    [ob_get_clean] => 1
    [ob_get_flush] => 1
    [restore_include_path] => 1
    [set_include_path] => 1
    [str_shuffle] => 1
    [str_word_count] => 1
    [FILE] => 1
    [STD] => 1
    [UPLOAD_ERR] => 1
)

Note

This function should be called statically.