CodeIgniter User Guide Version 1.6.1


Compatibility Helper

The Compatibility Helper file contains PHP 4 implementations of some PHP 5 only native PHP functions and constants. This can be useful if you'd like to take advantage of some of these native function but your application may end up running on a PHP 4 server. In these cases, it may be advantageous to Auto-load the Compatibility Helper so you do not have to load it in each controller.

Note: There are a few compatibility functions that are in CodeIgniter's native Compat.php file. You may use those functions without loading this helper. The functions are split between that file and this Helper so that only functions required by the framework are included by default. This way, whether or not you load the additional functions in this Helper remains your choice.

Loading this Helper

This helper is loaded using the following code:

$this->load->helper('compatibility');

Available Constants

The following constants are available:

PHP_EOL

The newline character for the server's current OS, e.g. on Windows systems "\r\n", on *nix "\n".

Available Functions

The following functions are available (see linked PHP documentation for documentation):

file_put_contents() - The fourth parameter, $context, is not supported.

fputcsv()

http_build_query()

str_ireplace() - The fourth parameter, $count, is not supported, as PHP 4 would make it become required.

stripos()