Return to Snippet

Revision: 27027
at May 20, 2010 09:10 by frankyfish


Updated Code
define('ENVIRONMENT', preg_match('/(dev\.)|(\.local)|(localhost)|(192\.168)/', $_SERVER["HTTP_HOST"]) ? "dev" : "prod");

Revision: 27026
at May 20, 2010 09:04 by frankyfish


Initial Code
define('ENVIRONMENT', preg_match('/(\.local\/)|(localhost)|(192\.168)/', $_SERVER["HTTP_HOST"]) ? "dev" : "prod");

Initial URL

                                

Initial Description
Will return "dev" when it detect those syntax in the hostname
dev.
.local
localhost
192.168

Initial Title
Detect Dev or Prod environment

Initial Tags

                                

Initial Language
PHP