Will the php function time();
be functional after the year 2038?
Asked
Active
Viewed 1,284 times
7

dynamic
- 46,985
- 55
- 154
- 231
-
2will there be internet in 2038th ? – tereško Apr 28 '11 at 23:27
-
9If I knew how the world would work in 2038 I wouldn't be here answering questions... – Jon Apr 28 '11 at 23:29
-
4Depends if you're running a 32-bit or 64-bit version of PHP – Mark Baker Apr 28 '11 at 23:29
-
1@Jon: You made me giggle, will sticks and stones work in 2038? – Alix Axel Apr 28 '11 at 23:33
-
lol @alix lol maybe you are right i am worrying about it too early – dynamic Apr 28 '11 at 23:37
-
@PeeHaa: Tell me the time so that I can make popcorns. – Alix Axel Apr 28 '11 at 23:42
2 Answers
9
Of course, when the time comes PHP 42.1.3 will natively support 64-bit integers.

Alix Axel
- 151,645
- 95
- 393
- 500
-
php version 42? PHP born about 10 years ago and now it's version 5 :) i don't think in 20 years it will reach version 42 – dynamic Apr 28 '11 at 23:38
-
@yes123 Whatever version we have by then, I do know that PHP6 will still be on the horizon somewhere. – Wiseguy Apr 28 '11 at 23:41
-
8
0
Yes, it should be. But let me run that code in my VirtuaBox and changed the date as well in there.
you know it could be fun to try it out :)

fedmich
- 5,343
- 3
- 37
- 52
-
1You'll probably get a signed (negative) integer. Let me know how it goes! ;) – Alix Axel Apr 28 '11 at 23:31
-
also I'm imagining that by that time, there will be a better language, new language or it might not be even called PHP anymore – fedmich Apr 28 '11 at 23:32
-
2
-
@fedmich: No, RoR will be gone and PHP will still rule the world! NURV! :P – Alix Axel Apr 28 '11 at 23:34
-
@fedmich If PHP's name changes, it'll probably change to "PHP", where the first P stands for "PHP", [of which the first P stands for "PHP"](http://en.wikipedia.org/wiki/Recursive_acronym). Infinite recursion will crash the Internet. – Wiseguy Apr 28 '11 at 23:37
-
Wait a moment. I Don't think you have to run a virtualbox to change the date in your os – dynamic Apr 28 '11 at 23:43
-
4I just execute it and I got -2138856280 ... looks like our apps will break then :( – fedmich Apr 28 '11 at 23:48
-
@yes123 I couldnt change the date of my computer/server as there's too many apps going on and processing some stuff; so I could only execute codes like this via virtuabox. – fedmich Apr 28 '11 at 23:50
-
-
You can fake the system time using [libfaketime](http://www.code-wizards.com/projects/libfaketime/index.html). On Linux x86_64 with PHP 5.4.13, the value returned is not negative. `LD_PRELOAD=src/libfaketime.so.1 FAKETIME="31337-12-12 00:00:00" php -r 'echo time(),"\n";'` gives `48541007779`. Oh, but `date` seems to have issues interpreting `31337` though (`3508-03-16`). On the lucky side, `4242` works! – Lekensteyn Mar 23 '13 at 22:05