if condition to detect localhost and server

if condition to detect localhost and server Copy the below php code of if condition to detect localhost and server.  <?php if($_SERVER[‘HTTP_HOST’] ==’localhost:8080′) { define(‘DB_NAME’, ‘localdatabasename’); define(‘DB_USER’, ‘root’);//mostly root define(‘DB_PASSWORD’, ”); } else { define(‘DB_NAME’, ‘server database name’); define(‘DB_USER’, ‘server database user’); define(‘DB_PASSWORD’, ‘dbpassword’); } ?>