Introduction

Introduction – Purpose and simple usage example

Description

PHP_Compat provides missing functionality in the form of functions and constants for older versions of PHP.

The replicated functions are designed to be interchangable with their native equivilants. They have the same signature, same return values and throw the same errors. Each function is unit tested to ensure accuracy.

Example

Loading a component with PHP_Compat:

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

PHP_Compat::loadFunction('file_get_contents');
?>

Or, if you don't wish to use the class, you can load it manually.

Loading a component manually:

<?php
require_once 'PHP/Compat/Function/file_put_contents.php';
?>

The function is then ready to use like you would normally.

PHP_Compat is designed for ease of use. It has no dependencies and can be used completely outside the PEAR infrastructure.