If-Modified-Since is an HTTP request header that the client sends to your browser along with a request for content. Last-Modified is an HTTP response header that your server returns to the client along with the requested content.
I can't answer PHP-specific questions -- wrong forum and lack of expertise, I'm afraid. But there are two parts to this:
In order for your server to send Last-Modified (in order to make it possible for a client to later send an If-Modified-Since), you do need to "enable Last-Modified" somehow -- though again, I cannot tell you if your PHP tweak is what is required.
But in addition, you will also need to check (in your script) the date/time in the If-Modified-Since header sent by the client against the Last-Modified date of the file --or the Last-Modified-Date of *significant* changes to the code produced by your script. If there have been no *significant* changes since the If-Modified-Since date/time sent by the client, then send a 304-Not Modified status response with no content-body. If there have been changes, then send a 200-OK response status, a new Last-Modified header, and the updated content.
This function may be available as a library function -- I do not know.
Your definition of *significant* changes will greatly affect the efficiency of this HTTP feature: If you consider minor changes to be important, then you will end up sending new content almost every time a request is received, and the page-loading speed and bandwidth-reduction advantages of client-side and network caching will be lost. If on the other hand, you set the bar too high, then visitors may see old or stale content for a long time. The basic problem is that the Last-Modified date/time of script-generated content is a very "fuzzy" concept.
If your content doesn't change often, then also look into server-side "caching" -- Saving static-file copies of dynamically-generated pages, and returning those instead of even running the PHP script when those files are still "current." Also look into the "Expires" and "Cache-Control" headers. It can get very complicated, but all of these headers can 'play together' to significantly reduce the load on your server and to improve the page-load time and visitor experience on your site.