Convert Helper
A simple collection if helper functions designed for conversion and decoding of string values.
This helper is loaded using the following code:
$this->load->helper('convert');
The following functions are available:
ascii_to_hex(ascii)
Convert ascii string to hex format.
hex_to_ascii(hex)
Convert hex string to ascii string.
uri_safe_encode(str, [hexify])
Convert a string into a safe, encoded uri value. The hexify option will remove common non uri-safe characters like the equals (=) sign.
uri_safe_decode(str, [hexify])
Decode a base64 encoded string value encoded with uri_safe_encode. The hexify option will remove common non uri-safe characters like the equals (=) sign.
uri_safe_batch_encode(uri, [delimiter], [hexify])
Encode a key/value array or string into a URI safe value. The default delimiter is a pipe.
$params['first_name'] = 'Darth'; $params['last_name'] = 'Vader'; $seg_params = uri_safe_batch_encode($params, '|', TRUE); echo $seg_params; // 5a6d6c7963335266626d46745a53394559584a306148787359584e305832356862575576566d466b5a584a38
uri_safe_batch_decode(uri, [delimiter], [hexify])
Decode a key/value array or string into a URI safe value. The default delimiter is a pipe.
$params = uri_safe_batch_decode($this->uri->segment(3), '|', TRUE); echo $params['first_name']; // Darth echo $params['last_name']; // Vader