img()

img([$src = ''[, $index_page = FALSE[, $attributes = '']]]) Parameters: $src (string) – Image source data $index_page (bool) – Whether to treat $src as a routed URI string $attributes (array) – HTML attributes Returns: HTML image tag Return type: string Lets you create HTML <img /> tags. The first parameter contains the image source. Example: echo img('images/picture.jpg'); // gives <img src="http://site.com/images/picture.jpg" /> There is an optional second parameter

increment_string()

increment_string($str[, $separator = '_'[, $first = 1]]) Parameters: $str (string) – Input string $separator (string) – Separator to append a duplicate number with $first (int) – Starting number Returns: An incremented string Return type: string Increments a string by appending a number to it or increasing the number. Useful for creating “copies” or a file or duplicating database content which has unique titles or slugs. Usage example: echo increment_string('file', '_'); // "file_

index_page()

index_page() Returns: ‘index_page’ value Return type: mixed Returns your site index_page, as specified in your config file. Example: echo index_page();

human_to_unix()

human_to_unix([$datestr = '']) Parameters: $datestr (int) – Date string Returns: UNIX timestamp or FALSE on failure Return type: int The opposite of the unix_to_time() function. Takes a “human” time as input and returns it as a UNIX timestamp. This is useful if you accept “human” formatted dates submitted via a form. Returns boolean FALSE date string passed to it is not formatted as indicated above. Example: $now = time(); $human = unix_to_human($now); $unix = human_to_unix($human);

highlight_phrase()

highlight_phrase($str, $phrase[, $tag_open = ''[, $tag_close = '']]) Parameters: $str (string) – Input string $phrase (string) – Phrase to highlight $tag_open (string) – Opening tag used for the highlight $tag_close (string) – Closing tag for the highlight Returns: String with a phrase highlighted via HTML Return type: string Will highlight a phrase within a text string. The first parameter will contain the original string, the second will contain the phrase you wish to highlight

humanize()

humanize($str[, $separator = '_']) Parameters: $str (string) – Input string $separator (string) – Input separator Returns: Humanized string Return type: string Takes multiple words separated by underscores and adds spaces between them. Each word is capitalized. Example: echo humanize('my_dog_spot'); // Prints 'My Dog Spot' To use dashes instead of underscores: echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot'

html_escape()

html_escape($var) Parameters: $var (mixed) – Variable to escape (string or array) Returns: HTML escaped string(s) Return type: mixed This function acts as an alias for PHP’s native htmlspecialchars() function, with the advantage of being able to accept an array of strings. It is useful in preventing Cross Site Scripting (XSS).

highlight_code()

highlight_code($str) Parameters: $str (string) – Input string Returns: String with code highlighted via HTML Return type: string Colorizes a string of code (PHP, HTML, etc.). Example: $string = highlight_code($string); The function uses PHP’s highlight_string() function, so the colors used are the ones specified in your php.ini file.

Hooks - Extending the Framework Core

CodeIgniter’s Hooks feature provides a means to tap into and modify the inner workings of the framework without hacking the core files. When CodeIgniter runs it follows a specific execution process, diagramed in the Application Flow page. There may be instances, however, where you’d like to cause some action to take place at a particular stage in the execution process. For example, you might want to run a script right before your controllers get loaded, or right after, or you might want to trig

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