0

TL;DR: Whats better?

cookie_expires = time()+( (60*60*24)*31 )

vs.

cookie_expires = SECONDS_month

To save time and typing, for years I have been declaring useful time values at the start of my apps.

SECONDS_hour = 3600
SECONDS_day = 86400
SECONDS_week = 604800
SECONDS_month = 2678400
SECONDS_year = 31557600

I was wondering what the gurus here think. Should I not waste the effort and just calculate as needed?

jwodder
  • 54,758
  • 12
  • 108
  • 124
ethanpil
  • 2,522
  • 2
  • 24
  • 34

1 Answers1

0

In my opinion readability always goes first:

"one_week_in_seconds" is way better than 60*60*24*7!

Manuel Spezzani
  • 1,041
  • 7
  • 15