FUEL CMS User Guide : Version 0.9.3


MY Compatibility Helper

Contains functions to bridge the gap with older versions of PHP. Extends CI's compatability helpers and is autoloaded.

This helper is loaded using the following code:

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

The following functions are available:

json_encode(data)

Used for older versions of PHP that don't support json_encode.

$my_arr[0] = array('first_name' => 'Darth', 'last_name' => 'Vader');
$my_arr[1] = array('first_name' => 'Luke', 'last_name' => 'Skywalker');
$my_arr[2] = array('first_name' => 'Han', 'last_name' => 'Solo');

$new_arr = array_sorter($my_arr, 'first_name', 'asc');

echo $new_arr[0]['first_name'].' '.$new_arr[0]['last_name']; // Luke Skywalker

json_decode(data)

Used for older versions of PHP that don't support json_decode.

echo $my_obj[0]->first_name.' '.$my_obj[0]->last_name; // Luke Skywalker

str_getcsv(input, [delimiter], [enclosure])

Used for older versions of PHP that don't support str_getcsv.

str_putcsv(input, [delimiter], [enclosure])

Not really a compatibility function since it doesn't exist natively in PHP. However it probably should so we provide it here.