How can I create sub site like http://a.xyz.com using PHP?
Let's say I have xyz.com and not I want to get a.xyz.com created for user "a". Any way to create this dynamically using PHP?
This is more of a web hosting issue. You need to check with your web hosting control panel. What you want to look for is the facility to create subdomains (the "a" in http://a.xyz.com is a subdomain). This is pretty standard on a lot of hosting accounts, such as those that use CPanel.
What you actually need is wildcard subdomains. Like, *.example.com would point to the same place as example.com and Apache or IIS would treat it the same. In PHP you would then use $SERVER['HTTPHOST'] to find if the subdomain is a valid username.
However, I must recommend against such practice. While it is nifty, it is a lot of work to get right, and can have security implications.
Thanks a lot for quick response! Both answers address the issue.