I was just going through some code and was wondering if it is bad to call time() multiple times on a page?
Yes, I know that it will work when called repeatedly, but will there be a big speed difference?
Option #1: Call time() whenever you need the current Unix timestamp.
Option #2: Set a variable $timestamp = time(); and call the variable whenever the time is needed.
That depends on the situation. Some scripts run for more than a few seconds, some could run for hours. Then the new value of time() would be wanted.
If a difference in time that is shorter than the time it takes for your php code to execute won't cause any problems then you might as well use Option #2 since it is slightly faster. But, the speed difference is negligible unless you make tons of calls to time().