hash_equals()

hash_equals($known_string, $user_string) Parameters: $known_string (string) – Known string $user_string (string) – User-supplied string Returns: TRUE if the strings match, FALSE otherwise Return type: string For more information, please refer to the PHP manual for hash_equals().

heading()

heading([$data = ''[, $h = '1'[, $attributes = '']]]) Parameters: $data (string) – Content $h (string) – Heading level $attributes (mixed) – HTML attributes Returns: HTML heading tag Return type: string Lets you create HTML heading tags. The first parameter will contain the data, the second the size of the heading. Example: echo heading('Welcome!', 3); The above would produce: <h3>Welcome!</h3> Additionally, in order to add attributes to the heading tag such as HTML c

Helper Functions

Helpers, as the name suggests, help you with tasks. Each helper file is simply a collection of functions in a particular category. There are URL Helpers, that assist in creating links, there are Form Helpers that help you create form elements, Text Helpers perform various text formatting routines, Cookie Helpers set and read cookies, File Helpers help you deal with files, etc. Unlike most other systems in CodeIgniter, Helpers are not written in an Object Oriented format. They are simple, proced

Handling Multiple Environments

Developers often desire different system behavior depending on whether an application is running in a development or production environment. For example, verbose error output is something that would be useful while developing an application, but it may also pose a security issue when “live”. The ENVIRONMENT Constant By default, CodeIgniter comes with the environment constant set to use the value provided in $_SERVER['CI_ENV'], otherwise defaults to ‘development’. At the top of index.php, you wi

hash_pbkdf2()

hash_pbkdf2($algo, $password, $salt, $iterations[, $length = 0[, $raw_output = FALSE]]) Parameters: $algo (string) – Hashing algorithm $password (string) – Password $salt (string) – Hash salt $iterations (int) – Number of iterations to perform during derivation $length (int) – Output string length $raw_output (bool) – Whether to return raw binary data Returns: Password-derived key or FALSE on failure Return type: string For more information, please refer to the PHP manual for h

get_mimes()

get_mimes() Returns: An associative array of file types Return type: array This function returns a reference to the MIMEs array from application/config/mimes.php.

get_mime_by_extension()

get_mime_by_extension($filename) Parameters: $filename (string) – File name Returns: MIME type string or FALSE on failure Return type: string Translates a filename extension into a MIME type based on config/mimes.php. Returns FALSE if it can’t determine the type, or read the MIME config file. $file = 'somefile.png'; echo $file.' is has a mime type of '.get_mime_by_extension($file); Note This is not an accurate way of determining file MIME types, and is here strictly for convenienc

get_file_info()

get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) Parameters: $file (string) – File path $returned_values (array) – What type of info to return Returns: An array containing info on the specified file or FALSE on failure Return type: array Given a file and path, returns (optionally) the name, path, size and date modified information attributes for a file. Second parameter allows you to explicitly declare what information you want returned. Valid

get_filenames()

get_filenames($source_dir[, $include_path = FALSE]) Parameters: $source_dir (string) – Directory path $include_path (bool) – Whether to include the path as part of the filenames Returns: An array of file names Return type: array Takes a server path as input and returns an array containing the names of all files contained within it. The file path can optionally be added to the file names by setting the second parameter to TRUE. Example: $controllers = get_filenames(APPPATH.'controll

gmt_to_local()

gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) Parameters: $time (int) – UNIX timestamp $timezone (string) – Timezone $dst (bool) – Whether DST is active Returns: UNIX timestamp Return type: int Takes a UNIX timestamp (referenced to GMT) as input, and converts it to a localized timestamp based on the timezone and Daylight Saving Time submitted. Example: $timestamp = 1140153693; $timezone = 'UM8'; $daylight_saving = TRUE; echo gmt_to_local($timestamp, $timezone, $