How can GET variables be passed and called in PHP?

GET variables can be passed in a URL as key-value pairs and accessed in PHP using the $_GET superglobal array. To pass GET variables, simply append them to the URL after a question mark (?), separated by ampersands (&). In PHP, you can access these variables by referencing their keys in the $_GET array.

// Example of passing and accessing GET variables in PHP

// URL: http://example.com/index.php?name=John&age=30

$name = $_GET['name']; // Retrieves the value of 'name' variable
$age = $_GET['age']; // Retrieves the value of 'age' variable

echo "Name: $name, Age: $age"; // Outputs: Name: John, Age: 30