Posted By

frankyfish on 05/20/10


Tagged


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

d0ri0
dantreacy


Detect Dev or Prod environment


 / Published in: PHP
 

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

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

Report this snippet  

You need to login to post a comment.