if($_SERVER["REQUEST_METHOD"] == "POST"){ // Execute code for POST request }
$request_method = $_SERVER["REQUEST_METHOD"]; echo "The request method used is: " . $request_method;In this example, we are storing the request method in a variable and then printing it out to the user to let them know which request method was used to access the current page. Package Library: There is no specific package library for this function as it is a core PHP function.