$url = 'https://my-domain.com/api/v2/users/order/12345?nonce=89462486239839&user=kfneklfnefkflne&key=vkjsiueve';
PHP 8.5 class
$uri = new Uri($url); $result = [ 'host' => $uri->getHost(), 'path' => $uri->getPath(), 'query' => $uri->getQuery() ];
This take 14.8 µs
Old way using parse_url()
$url = 'https://my-domain.com/api/v2/users/order/12345?nonce=89462486239839&user=kfneklfnefkflne&key=vkjsiueve'; $result = parse_url($url);
this take 3.1 µs