I am having a client who need a script which can build sub domain for each user signup.

for example if I am signing up to the system as "priya" then I will get a subdomain like priya.xyz.com

can anyone help ?