What is the significance of using $_REQUEST in PHP and how does it relate to superglobal arrays like $_GET and $_POST?

Using $_REQUEST in PHP allows you to access data sent to the server through both GET and POST methods. This provides flexibility in handling form data without needing to distinguish between the two methods. However, it is important to note that using $_REQUEST can be less secure than using $_GET or $_POST directly, as it can make your code vulnerable to CSRF attacks.

// Example of using $_REQUEST to handle form data
if ($_SERVER["REQUEST_METHOD"] == "POST") {
    $username = $_REQUEST["username"];
    $password = $_REQUEST["password"];
    
    // Process the form data
}