3 ms·
There may actually be a good reason for writing code like that. The time the content was generated by the server, perhaps?
by robertduncan 16y ago
There may actually be a good reason for writing code like that. The time the content was generated by the server, perhaps?
- chc 16y agoThat wouldn't be a good reason for writing that code. Putting it in a function like that suggests that you expect the value to change. It's like the xkcd joke where a random() function is implemented to return 4, as determined by a fair dice roll. If you just wanted to store the time the page was generated, it would make more sense to use a constant — for example: window.pageBirthday = <?php echo time(); ?> Also, if they're on Stack Overflow asking why it doesn't correctly report the current time, that's a pretty good indicator that they're simply mistaken.