1$parts = parse_url($url);
2parse_str($parts['query'], $query);
3echo $query['email'];
4
1phpCopy<?php
2$url = "https://testurl.com/test/1234?email=abc@test.com&name=sarah";
3$components = parse_url($url);
4parse_str($components['query'], $results);
5print_r($results);
6?>
7
1phpCopy<?php
2$url = "https://testurl.com/test/1234?email=abc@test.com&name=sarah";
3$components = parse_url($url);
4parse_str($components['query'], $results);
5echo($results['email']);
6?>
7
1phpCopy<?php
2$url = "https://testurl.com/test/1234?email=abc@test.com&name=sarah";
3$components = parse_url($url, PHP_URL_QUERY);
4//$component parameter is PHP_URL_QUERY
5parse_str($components, $results);
6print_r($results);
7?>
8
1<?php
2if (isset($_GET['link'])) {
3 echo $_GET['link'];
4} else {
5 // Fallback behaviour goes here
6}
7