Last active
December 18, 2015 11:19
-
-
Save peterfox/5774740 to your computer and use it in GitHub Desktop.
A template of a function being applied to a CodeIgniter Helper file, the If statement checks if the function is already loaded, this is a good convention, it also means if you want to simulate a function not included in a current PHP version but is in a later one it'll be swapped in.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ( ! function_exists('element')) | |
{ | |
function element($item, $array, $default = FALSE) | |
{ | |
if ( ! isset($array[$item]) OR $array[$item] == "") | |
{ | |
return $default; | |
} | |
return $array[$item]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment