How to make a comparison of the reference standard?

Good afternoon.
There are two variables: one, the link specified by default on the server.
The second reference, received from a post request.
How can you compare them (need to match domain name)?
$a = $_POST['link'];
$b = 'domain.com';

I understand that you need to disassemble the link in and using preg_replace, but I don't know how to do it, to leave only the domain.
April 19th 20 at 12:29
1 answer
April 19th 20 at 12:31
Solution
$url = 'https://google.com';

var_dump(parse_url($url, PHP_URL_HOST));

Find more questions by tags PHP