Created
October 16, 2013 18:09
-
-
Save strattondev/7012207 to your computer and use it in GitHub Desktop.
PH Multi Define function
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
/** | |
* Defines mutiple objects | |
* | |
* @param mixed $key Key to define or Array of keys to define | |
* @param mixed $value Value to corespond with single key or FALSE | |
* @return bool | |
*/ | |
function multiDefine($key, $value = FALSE) { | |
if (is_null($key)) return FALSE; | |
if (is_array($key)) | |
foreach ($key as $k => $v) | |
if (!defined($k)) define($k, $v); | |
else | |
if (!defined($key)) define($key, $value) | |
return TRUE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment