How do I connect a single PHP script to multiple pages?

I want to display a “Last Published” date on my site’s articles using PHP. My site files are PHP pages.

Originally I had a piece of code in each article page, however I’ve now learned that is very bad design.

What code would I insert in my article pages to connect to a single, separate php script file, so that my “last modified” date will show up in my articles?