$_GET is not a function or language construct—it's just a variable (an array). Try:

<?php
echo $_GET['link'];

In particular, it's a superglobal: a built-in variable that's populated by PHP and is available in all scopes (you can use it from inside a function without the global keyword).

Since the variable might not exist, you could (and should) ensure your code does not trigger notices with:

<?php
if (isset($_GET['link'])) {
    echo $_GET['link'];
} else {
    // Fallback behaviour goes here
}

Alternatively, if you want to skip manual index checks and maybe add further validations you can use the filter extension:

<?php
echo filter_input(INPUT_GET, 'link', FILTER_SANITIZE_URL);

Last but not least, you can use the null coalescing operator (available since PHP/7.0) to handle missing parameters:

echo $_GET['link'] ?? 'Fallback value';
Answer from Álvaro González on Stack Overflow
🌐
PHP
php.net › manual › en › reserved.variables.get.php
PHP: $_GET - Manual
The values in $_GET are automatically passed through urldecode().
🌐
Nabilhassen
nabilhassen.com › how-to-read-and-get-url-parameters-in-php
How to Read and Get URL Parameters in PHP - Nabil Hassen
September 24, 2025 - The simplest and most common way to access URL parameters in PHP is via the superglobal $_GET.
🌐
GeeksforGeeks
geeksforgeeks.org › php › how-to-get-parameters-from-a-url-string-in-php
How to get parameters from a URL string in PHP? - GeeksforGeeks
July 11, 2025 - The parameters from a URL string can be retrieved in PHP using parse_url() and parse_str() functions.
🌐
TutorialsPoint
tutorialspoint.com › article › how-to-get-parameters-from-a-url-string-in-php
How to get parameters from a URL string in PHP?
<?php $url = 'http://www.example.com/page'; $res = parse_url($url); if (isset($res['query'])) { parse_str($res['query'], $params); print_r($params); } else { echo 'No parameters found in URL'; } ?>
🌐
W3Docs
w3docs.com › php
How to Get Parameters from a URL String with PHP | W3Docs
... <‌?php // Initialize URL to the variable $url = 'http://w3docs.com?name=John'; // Use parse_url() function to parse the URL // and return an associative array which // contains its various components $url_components = parse_url($url); ...
🌐
Delft Stack
delftstack.com › home › howto › php › how to get parameters from a url string in php
How to Get Parameters From a URL String in PHP | Delft Stack
February 2, 2024 - We can use the built-in functions parse_url() and parse_str() functions to get parameters from a URL string. These functions are used together to get the parameters. The function parse_url will divide the URL into different parameters.
🌐
Edureka Community
edureka.co › home › community › categories › web development › php › how to get url parameter in php
How to GET URL parameter in PHP | Edureka Community
September 17, 2020 - I'm trying to pass a URL as a url parameter in php but when I try to get this parameter I get ... 'link']; But nothing returned. What is the problem?
Find elsewhere
🌐
W3Schools
w3schools.com › php › php_superglobals_get.asp
PHP $_GET Superglobal
PHP superglobals are built-in variables that are always accessible in all scopes! There are two main ways to send variables via the HTTP GET method: via query strings in the URL · via HTML forms with method="get" A query string is data added to the end of a URL. In the <a> element below, everything after the ? sign is the query string: HTML link with URL query parameters: <html> <body> <a href="demo_phpfile.php?subject=PHP&web=W3schools.com">Test $GET</a> </body> </html> The query string above contains two key/value pairs: subject=PHP ·
🌐
Nono Martínez Alonso
nono.ma › parse-url-parameters-php
Get URL parameters in PHP · Nono Martínez Alonso
August 29, 2022 - You can use the parse_url built-in PHP method to break down a URL into its components. here's the method itself. parse_url(string $url, int $component = -1): int|string|array|null|false · And here's how to use it. parse_url("https://gettin...
🌐
W3docs
w3docs.com › home › code snippets › php › get url query string parameters
Get URL query string parameters | W3docs
To get the query string parameters in PHP, you can use the $_GET superglobal array. This array contains key-value pairs of the query string parameters. For example, if the URL of the page is http://example.com/page.php?key1=value1&key2=value2, ...
🌐
Strangebuzz
strangebuzz.com › home › snippets › extracting the get parameters of an url with php
Extracting the GET parameters of an URL with PHP | Strangebuzz
This snippet shows how to extract the GET parameters of an URL with PHP. We can use parse_url(), providing the PHP_URL_QUERY as the second parameter, so th
🌐
Wordpress Experts
wp-experts.in › blog › 2020 › 05 › 25 › how-to-get-parameters-value-from-a-url-in-php
How to get parameters value from a URL in PHP
parse_str($parseurl['query'], $data); Below examples uses parse_url() and parse_str() function to get the parameters value from URL string. <?php $url = 'https://www.yourdomain.com/?country=UK&state=London&city=London'; $parse_ary = parse_url($url); // check parameters exiting in url or not ...
🌐
Techfry
techfry.com › home › php tutorial › how to get url of current page in php
How To Get URL of Current Page in PHP - Tech Fry
June 12, 2021 - Some people might not prefer the explode() function to remove the parameters in a URL because it returns an array and they have to access the first element of that array in order to get the URL.
🌐
SitePoint
sitepoint.com › php
PHP Function to Get All Parameters in URL - PHP - SitePoint Forums | Web Development & Design Community
October 22, 2016 - I have a page that only expects three parameters in the url, but people add more to cache break and do other tricks. I want PHP to collect all parameters in the URL. To confirm that only the allowed parameters exist. If…
🌐
GitHub
gist.github.com › cf6536d423171559dc67e788050e1a43
php getUrlParameter · GitHub
Clone via HTTPS Clone using the web URL. ... Clone this repository at &lt;script src=&quot;https://gist.github.com/salines/cf6536d423171559dc67e788050e1a43.js&quot;&gt;&lt;/script&gt; Save salines/cf6536d423171559dc67e788050e1a43 to your computer and use it in GitHub Desktop. ... public function getUrlParameters() { $url_components = parse_url($_SERVER['REQUEST_URI']); parse_str($url_components['query'], $params); return $params; }