emma57573 Posted March 30, 2009 Share Posted March 30, 2009 What Im trying to do is if somebody types in www.theirdomain It removes the www. part and they are just left with theirdomain MY Code $domain=$_REQUEST["domain"]; $patterns[0] = '/www./'; $replacements[0] = ''; preg_replace($patterns, $replacements, $domain); It outputs www.theirdomain so does not remove the www. bit as I want it to? Any ideas where I am going wrong? Quote Link to comment Share on other sites More sharing options...
emma57573 Posted March 30, 2009 Author Share Posted March 30, 2009 Ive now tried taking out the slashes and got this error [phpBB Debug] PHP Notice: in file /home/misimeuk/public_html/store_infotest.php on line 31: preg_replace() [function.preg-replace]: Delimiter must not be alphanumeric or backslash Does that mean I cant use preg_replace with a '.' :-\ Quote Link to comment Share on other sites More sharing options...
emma57573 Posted March 30, 2009 Author Share Posted March 30, 2009 Ive fixed this with the following: $domain=$_REQUEST["domain"]; $patterns = "www."; $replacements = ""; $domain = str_replace($patterns, $replacements, $domain); Sometimes just writing out te question helps you think with a clear head Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.