/ Published in: PHP
                    
                                        
Will return "dev" when it detect those syntax in the hostname
dev.
.local
localhost
192.168
                dev.
.local
localhost
192.168
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
define('ENVIRONMENT', preg_match('/(dev\.)|(\.local)|(localhost)|(192\.168)/', $_SERVER["HTTP_HOST"]) ? "dev" : "prod");
Comments
 Subscribe to comments
                    Subscribe to comments
                
                