Reserved Names

In order to help out, CodeIgniter uses a series of function, method, class and variable names in its operation. Because of this, some names cannot be used by a developer. Following is a list of reserved names that cannot be used. Controller names Since your controller classes will extend the main application controller you must be careful not to name your methods identically to the ones used by that class, otherwise your local methods will override them. The following is a list of reserved name

repeater()

repeater($data[, $num = 1]) Parameters: $data (string) – Input $num (int) – Number of times to repeat Returns: Repeated string Return type: string Generates repeating copies of the data you submit. Example: $string = "\n"; echo repeater($string, 30); The above would generate 30 newlines. Note This function is DEPRECATED. Use the native str_repeat() instead.

remove_invisible_characters()

remove_invisible_characters($str[, $url_encoded = TRUE]) Parameters: $str (string) – Input string $url_encoded (bool) – Whether to remove URL-encoded characters as well Returns: Sanitized string Return type: string This function prevents inserting NULL characters between ASCII characters, like Java\0script. Example: remove_invisible_characters('Java\\0script'); // Returns: 'Javascript'

reduce_multiples()

reduce_multiples($str[, $character = ''[, $trim = FALSE]]) Parameters: $str (string) – Text to search in $character (string) – Character to reduce $trim (bool) – Whether to also trim the specified character Returns: Reduced string Return type: string Reduces multiple instances of a particular character occuring directly after each other. Example: $string = "Fred, Bill,, Joe, Jimmy"; $string = reduce_multiples($string,","); //results in "Fred, Bill, Joe, Jimmy" If the third parame

reduce_double_slashes()

reduce_double_slashes($str) Parameters: $str (string) – Input string Returns: A string with normalized slashes Return type: string Converts double slashes in a string to a single slash, except those found in URL protocol prefixes (e.g. http://). Example: $string = "http://example.com//index.php"; echo reduce_double_slashes($string); // results in "http://example.com/index.php"

redirect()

redirect($uri = '', $method = 'auto', $code = NULL) Parameters: $uri (string) – URI string $method (string) – Redirect method (‘auto’, ‘location’ or ‘refresh’) $code (string) – HTTP Response code (usually 302 or 303) Return type: void Does a “header redirect” to the URI specified. If you specify the full site URL that link will be built, but for local links simply providing the URI segments to the controller you want to direct to will create the link. The function will build the URL

read_file()

read_file($file) Parameters: $file (string) – File path Returns: File contents or FALSE on failure Return type: string Returns the data contained in the file specified in the path. Example: $string = read_file('./path/to/file.php'); The path can be a relative or full server path. Returns FALSE (boolean) on failure. Note The path is relative to your main site index.php file, NOT your controller or view files. CodeIgniter uses a front controller so paths are always relative to the m

random_string()

random_string([$type = 'alnum'[, $len = 8]]) Parameters: $type (string) – Randomization type $len (int) – Output string length Returns: A random string Return type: string Generates a random string based on the type and length you specify. Useful for creating passwords or generating random hashes. The first parameter specifies the type of string, the second parameter specifies the length. The following choices are available: alpha: A string with lower and uppercase letters only.

random_element()

random_element($array) Parameters: $array (array) – Input array Returns: A random element from the array Return type: mixed Takes an array as input and returns a random element from it. Usage example: $quotes = array( "I find that the harder I work, the more luck I seem to have. - Thomas Jefferson", "Don't stay in bed, unless you can make money in bed. - George Burns", "We didn't lose the game; we just ran out of time. - Vince Lombardi", "If everythin

quotes_to_entities()

quotes_to_entities($str) Parameters: $str (string) – Input string Returns: String with quotes converted to HTML entities Return type: string Converts single and double quotes in a string to the corresponding HTML entities. Example: $string = "Joe's \"dinner\""; $string = quotes_to_entities($string); //results in "Joe's "dinner""