On quite a large site I am considering adding a line of code that creates a constant for the current date, using date(‘U’).
This is because a vast amount of pages uses this function.
To me it seems lightweight enough to include in the site header, would this be considered bad practice?
“Premature optimization is the root of all evil” – this saying should be pinned at every developer’s workplace.
If you find such a constant useful – you’re welcome to define it in the site bootstrap file.
But nor this constant nor direct call to
date()will never affect overall performance of your site.