Search

CodeIgniter Common Functions

CodeIgniter uses a few common functions for its operation that are globally defined, and are available to you at any point. These do not require loading any libraries or helpers.

  • is_php()
  • is_really_writable()
  • config_item()
  • set_status_header()
  • html_escape()
  • get_mimes()
  • is_https()
  • is_cli()
  • function_usable()

is_php()

This function if the PHP version being used is greater than the supplied version number.

Syntaxis_php($version)
Parameters$version (string) ? Version number
ReturnTRUE if the running PHP version is at least the one specified or FALSE if not Return Type void
DescriptionDetermines if the PHP version being used is greater than the supplied version number.

is_really_writable()

This function checks to see if file is writable or not.

Syntaxis_really_writable($file)
Parameters$file (string) ? File path
ReturnTRUE if the path is writable, FALSE if not Return Type bool
DescriptionChecks to see if file is writable or not.

config_item()

This function is used to get the configuration item

Syntaxconfig_item($key)
Parameters$key (string) ? Config item key
ReturnConfiguration key value or NULL if not found Return Type mixed
DescriptionThis function is used to get the configuration item

set_status_header()

This function permits you to manually set a server status header.

Syntaxset_status_header($code[, $text = ''])
Parameters$text (string) ? A custom message to set with the status code , $code (int) ? HTTP Response status code 
Return Return Type void
DescriptionThis function is used to get the configuration item

html_escape()

This function acts as a native PHP htmlspecialchars() function.

Syntaxhtml_escape($var)
Parameters$var (mixed) ? Variable to escape (string or array)
ReturnHTML escaped string(s) Return Type mixed
DescriptionThis function acts as a native PHP htmlspecialchars() function.

get_mimes()

This function acts as a native PHP htmlspecialchars() function.

Syntaxget_mimes()
ParametersAn associative array of file types Return Type array
ReturnHTML escaped string(s) Return Type mixed
DescriptionThis function returns a reference to the MIMEs array from application/config/mimes.php.

is_https()

This function Returns TRUE if a secure (HTTPS) connection is used and FALSE in any other case (including non-HTTP requests).

Syntaxget_mimes()
ReturnTRUE if currently using HTTP-over-SSL, FALSE if not Return Type bool
DescriptionReturns TRUE if a secure (HTTPS) connection is used and FALSE in any other case (including non-HTTP requests).

is_cli()

This function Returns TRUE if a secure (HTTPS) connection is used and FALSE in any other case (including non-HTTP requests).

Syntaxget_mimes()
ReturnTRUE if currently running under CLI, FALSE otherwise Return Type bool
DescriptionReturns TRUE if the application is run through the command line and FALSE if not.

function_usable()

This function Returns TRUE if a function exists and is usable, FALSE otherwise.

Syntaxget_mimes()
Parameters$function_name (string) ? Function name
ReturnReturn Type bool
DescriptionReturns TRUE if a function exists and is usable, FALSE otherwise.

Stack Overlode is optimized Tutorials and examples for learning and training. Examples might be simplified to improve reading and learning and understand. Tutorials and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using Stack Overlode, you agree to have read and accepted our terms of use, cookie and privacy policy.