I have a static domain of dev.example.com with wildcard subdomains like so *.dev.example.com.
dev.example.com
*.dev.example.com
I need to detect the name of the current wild
Here's a little function that'll do the trick. Just stick $_SERVER['HTTP_HOST'] into the function and you should get what you want
function getSubDomain ($domain) { $eDom = explode('.', $domain); return $eDom[0]; } echo getSubDomain('sub.dev.example.com'); // echo 'sub'