(inspired by Janek's comment)
IF your Apache instance is configured for * aliasing, then there is no need to create a virtual named host - You can fake it with PHP by evaluating $_SERVER['HTTP_HOST'].
To determine if your Apache instance will handle it, edit your local /etc/hosts file (or windows equivalent - %SystemRoot%\system32\drivers\etc\hosts) so that the desired virtual name is pointing to your server.
For instance
# An example HOSTS file.
192.168.1.4 testserver testserver.com subdomain.testserver.com secondname.com
This assume that 192.168.1.4 is the IP of your server. Everything after that are alias's that the server can be called.
Then, as Janek suggested create a page that will echo $_SERVER['HTTP_HOST']
to see if it capturing the name correctly. If so, then all that is required is a DNS change and Apache can remain unchanged.
Otherwise without access to Apache.conf (this kind of implies that you don't have access to a lot of things) this will be difficult to pull off. The programming won't be - but the implementation will be.
Here's why:
Apache by default will serve up virtual hosts. But you do need access to the server's conf directory (often located in /etc/httpd/conf.d/) so you can create the virtual host "include" file (IF the Apache configuration is setup to include it - most recent installs should be).
You will need to be able to cycle Apache (restart). Without this the Virtual Host changes won't take affect.
You will need to be able to change the DNS. You can always change your local /etc/hosts file - but in order for visitors to get to your site, you'll need to be able to push through a DNS change. (Which may instantaneous - or it may take 24 hours to propagate).
The scripting certainly can be done (see Cpanel and WHM)