Created
April 12, 2016 06:58
-
-
Save tuandm/def7cf8b647e4fbcc00501ed7f7db009 to your computer and use it in GitHub Desktop.
Array Utils
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
class JT_Util_Array | |
{ | |
/** | |
* Safety getting array's element. Return default value in case $key is not existed | |
* | |
* @param array $array | |
* @param string $key | |
* @param mixed $default | |
* @return mixed | |
*/ | |
public static function get(array $array, $key, $default = null) | |
{ | |
return isset($array[$key]) ? $array[$key] : $default; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment