if ($_SERVER['REQUEST_METHOD'] == 'POST') { // This block of code is executed if the request method is POST // Code to process form data } elseif ($_SERVER['REQUEST_METHOD'] == 'GET') { // This block of code is executed if the request method is GET // Code to display data or perform other operations }In this example, if the request method is POST, the script will execute code to process form data submitted via a form. If the request method is GET, the script will execute code to display data or perform other operations. The getRequestMethod function is part of the PHP core library and does not require any additional package or library.