<?php $url = 'https://example.com/pathurl'; $bits = parse_url($url); $sub = strtok($bits['host'], '.'); echo $sub . PHP_EOL; $url = 'https://subdomain.example.com/pathurl'; $bits = parse_url($url); $sub = strtok($bits['host'], '.'); echo $sub . PHP_EOL;
You have javascript disabled. You will not be able to edit any code.