You would need to do something like (this won't work):
<?php
echo "<html><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>";
@ob_flush(); //flush the output buffer
flush(); //flush anything else
sleep(6); //wait
header('Location: http://google.com/'); //redirect
?>
However: This won't work as expected, you cannot redirect the browser after sending content (PHP will throw and error and tell you this)
Instead you should:
<?php
echo "<html><meta http-equiv=\"refresh\" content=\"6;URL='http://YOURURL.com/'\"><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>";
?>
Where the <meta http-equiv="refresh" content="6;URL='http://YOURURL.com/'">
tag is an HTML tag to tell the browser to change to the provided url after 6 seconds
To avoid adding the meta tag, you could also do this:
<?php
header('Refresh: 6;URL=http://www.YOURURL.com/');
echo "<html><br><br><br><div id='loading'><p><img src='loader.gif'> Please wait 6 seconds...</p></div></html>"
?>
But to be safe you should add both the header and the meta tag!