- Forums
- PHP
- Function To Remove Domain Name .com Extenstion At The End
This Page Contains information about Function To Remove Domain Name .com Extenstion At The End By wallpaperama in category PHP with 0 Replies. [1263], Last Updated: Sat May 18, 2024
wallpaperama
Sun Apr 05, 2009
0 Comments
369 Visits
oh, i have this neat php function you can use to remove the extention from a tld domain name.
for example, lets say i have a hostname as : wallpaperama.com
but i only want the wallaperama part and not the dot com part so this function will remove the extesion from the domain name:
hope this helps
function remove_ext($filename) {
$extension = strrchr($filename, '.');
if($extension !== false){
$filename = substr($filename, 0, -strlen($extension));
}
return $filename;
}