Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- remove www. only if it exists


martymac - 3:05 pm on Oct 2, 2009 (gmt 0)


I have an list/array of URL's that are going to be stored in a DB:

example1.com
www.example2.com
example3.org
example4.net
www.example6.edu

How would I parse the URLs so that the "www." is removed from any domains that contain it, and the rest of the domains are not modified. The results should look like:

example1.com
example2.com
example3.org
example4.net
example6.edu


Thread source:: http://www.webmasterworld.com/php/3999960.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com