What are key-value pairs in PHP GET requests and how are they used?

Key-value pairs in PHP GET requests are used to pass data from the client side (such as a web browser) to the server side. The key represents the name of the parameter being passed, while the value represents the actual data being sent. These key-value pairs are appended to the URL as query parameters and can be accessed on the server side using the $_GET superglobal array.

// Example of using key-value pairs in PHP GET request
// URL: http://example.com/?name=John&age=25

$name = $_GET['name']; // Accessing the value of 'name' key
$age = $_GET['age']; // Accessing the value of 'age' key

echo "Name: " . $name . "<br>"; // Output: Name: John
echo "Age: " . $age; // Output: Age: 25