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
From PHP 5.3 you can use strstr() with true parameter
echo strstr('sub.dev.example.com', '.', true); //prints sub
Original link