What are some common HTTP header codes used in PHP for handling invalid data?

When handling invalid data in PHP, it is common to use HTTP header codes to communicate the status of the request to the client. Some common HTTP header codes for handling invalid data include 400 Bad Request, 422 Unprocessable Entity, and 403 Forbidden. These codes help to indicate to the client that the request was not processed due to invalid data being provided.

// Example of using HTTP header codes to handle invalid data
if ($invalidData) {
    header("HTTP/1.1 400 Bad Request");
    echo "Invalid data provided";
    exit;
}