How can you force a pause using sleep() in PHP while displaying a message during that time?

To force a pause using sleep() in PHP while displaying a message during that time, you can use the sleep() function to pause the script execution for a specified number of seconds, and then display the message after the sleep period. This can be useful for creating delays in scripts or showing loading messages to users.

<?php
$message = "Please wait while we process your request...";
echo $message;
sleep(5); // Pause for 5 seconds
echo "Process complete!";
?>