I noticed that it strtotime()handles unix timestamps in an odd way, and I was curious if anyone knows why this is:
var_export(strtotime('1330725042')); // false
var_export(strtotime('@1330725042')); // 1330725042
Why does it strtotime()return falsewhen specifying a unix timestamp (if the specified timestamp is not a prefix @)?
This is from the internal methods of the library method that I created, which is designed to “resolve” an unknown format variable into a timestamp. Using bare is strtotime()not useful in this case, because it returns an incorrect result when the input value is actually a timestamp.
I reworked the library method to explicitly check the timestamp-like value and return it unchanged, so ... we will not say that there is no more practical use for this issue; I'm just curious.
user212218
source
share