i want to also know how i can remove the tld from a domain name

lets say i have:

$domain = www.wallpaperama.com

so i only want this

$domain = wallpaperama

thanks