I accidentally posted in the wrong section of the forum...

http://www.daniweb.com/forums/thread279411.html

Im trying to use php echo to display domaincom (with no dot in between) and can't figure it out.

<?php echo(preg_replace('/^[a-z]*./','',$_SERVER["HTTP_HOST"])); ?>

works to display domain.com but I need domaincom

Recommended Answers

All 3 Replies

echo(preg_replace('/^[a-z]*.|\./','',$_SERVER["HTTP_HOST"]));

thanks! also, is it possible to display just "domain" stripping the dot and com?

This would be easy for .com domains, but if you have .co.uk for example it gets trickier.

^[a-z]*.|\.com
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.