![]() |
Help With PHP and timestamp
I set this up:
$time1=time(); Later On, $time2=time(); if I: echo $time1 -> 1109145600 echo $time2 -> 1109201240 But if I echo($time2 - $time1) -> -1109145600 Why? Why is it not 55640? Can Anyone help? |
Can't be.
But try echo((int)$time2 - (int)$time1); |
you sure your echo statement is exactly as shown? It should print 55640, unless you misspelled your variable, or maybe forgot to put brackets around your math statement.
Try doing: Code:
$time1=time(); |
My guess is that you've made a type on the echo?
ie PHP is calculating "0-$time1" |
by the way, if you are timing your application, use microtime() as it is more precise (milliseconds).
|
Damn, I should be in bed. That's exactly what it was doing.
0-$time1 mistyped var. Thanks for the help guys. |
hehe :) :)
|
All times are GMT -7. The time now is 04:58 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123