<?php $url = 'https://www.example.com#anchor'; $host = parse_url($url, PHP_URL_HOST); // www.example.com preg_match('/(\w+)\.(\w+)$/', $host, $matches); $array_result = array ( "name" => $matches[1], "tld" => $matches[2] ); print_r($array_result);
You have javascript disabled. You will not be able to edit any code.