This question already has an answer here:
- Switch case with three parameters? 7 answers
I need to detect different server environments in my site's config file. Up until now I was fine with detecting them using only the server's address.
switch ( $_SERVER['SERVER_ADDR']){
case '127.0.0.1':
// stuff
break;
case '111.222.333.444';
// stuff
break;
}
But I now need to test my environment against both the SERVER_ADDR
and SERVER_NAME
. I'm no php'er, so I've had a stab at
switch ( $_SERVER['SERVER_ADDR'] && $_SERVER['SERVER_NAME'] ){
case ('127.0.0.1','local'):
// stuff
break;
case ('111.222.333.444','gimmesomefunk.com');
// stuff
break;
}
But it's obviously wrong. Any clues?
</div>