Sometimes I need to use a value that is dynamic in a way that it would be different depending on whether the code is executed on a testing environment or a remote host.
To address that I've been using the following function:
function localhost($local_host_value, $remote_host_value = "")
{
if($_SERVER["REMOTE_ADDR"] == "127.0.0.1")
{
return $local_host_value;
}
else
{
return $remote_host_value;
}
}
Could you suggest a more elegant approach or at least a better name for the above quoted function?