Some effort to use with PHP:

<?php
$tsstring = gmdate("D, d M Y H:i:s ", $timestamp)."GMT";

if ($_SERVER["HTTP_IF_MODIFIED_SINCE"] == $tsstring) {
    /* The UA has the exact same page we have. */
    header("HTTP/1.1 304 Not Modified");
    exit();
} else {
    header("Last-Modified: ".$tsstring);
}
? >