![]() |
Use |
Example:
HTML
<?php
$host = parse_url('http://www.google.co.uk/test.html');
preg_match('/(.*?)((\.co)?.[a-z]{2,4})$/i', $host['host'], $m);
$ext = isset($m[2]) ? $m[2]: '';
echo $ext; ?>
How to count domain length in PHP | PHP Domain Tutorial |
How to get domain extension from php string | PHP Domain Tutorial |
How to get Domain http request info in PHP | PHP Domain Tutorial |
How to show Domain Extension from PHP String | PHP Domain Tutorial |
Read Full: | PHP Domain Tutorial |
Category: | Web Tutorial |
Sub Category: | PHP Domain Tutorial |
Uploaded by: | Admin |
Views: | 89 |
Tested on: | PHP 7 |
Reffered: https://stackoverflow.com/questions/17487559/getting-domain-extension-from-url