How to remove period from a string?

How to remove period from a string?

for example: www.domainname.com

It needs to be ‘wwwdomainnamecom’

Solution:
$Newdomainname = ereg_replace(‘.’, ”, $domainname);
or
$Newdomainname = str_replace(‘.’, ”, $domainname);