Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $defines = array(
- "DEFKEY"=>"upper", # Options are upper or lower
- "VERSION"=>"0.2.1", # Define a version
- "BUILD"=>"65", # and or define a build number
- "ENVIRONMENT" => "DEBUG", # Assigned is Debug, QA, Production
- "CLI" => false,
- "N" => "\n",
- "BRN" => "<br />\n",
- "BR" => "<br />",
- "T" => "\t",
- "DS" => DIRECTORY_SEPARATOR, # Are you on a Windows or Linux machine, let PHP handle the Directory Separator
- "ROOT" => str_replace(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR, getcwd())
- );
- # By assigning an array with keys you can give the ole define a quick and easy method to generate you most commonly used variables across all functions, classes, and just about anything else you throw at it.
- # To define everything, now it is as simple as assigning them with a foreach loop
- foreach ($defines as $key => $value) (!defined($key) ? define($key, $value) : die('Invalid constant '.$key));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement