- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$pattern = '{^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?}';
$url = 'https://example.com/a/support/topic/';
$result = preg_match( $pattern, $url, $matches );
var_dump($matches);