to calculate how long a company has been trading. Works well.
I am using a PHP framework which separates framework (generic) code from project-specific code. I would like to adjust this code so that it exists within the framework code and all I need in the project-specific code is a value I can code once (start_date) which I can send to this code (in a function say) and I need the result to be available easily from every page in the site (not just a master page but individual pages) which I can include with a short and simple span.
How to do this?
I’m guessing I put this code inside a function and replace the hard-coded start_date with a passed in value from the project specific side and have it return the value???
Not sure how to store the variable to pass in once? Constant?
I’m not sure if others would think this is a good practice, but I like to keep a helper function file as part of my framework which can be loaded as needed. Then I can just call a function from there when needed. I use this helper file to store functions that I use often, such as date and other kinds of formatting.