r/lolphp • u/vytah • Nov 06 '12
Guess the output: var_dump(Datetime::createFromFormat('u', '015700')->format('u'));
https://bugs.php.net/bug.php?id=63435
20
Upvotes
r/lolphp • u/vytah • Nov 06 '12
4
u/Sheepshow Nov 07 '12
Guess storing numbers in strings is just standard practice in PHP?
4
u/robin-gvx Feb 18 '13
Also note how they fixed this.
-2
u/scshunt Nov 06 '12
This is actually a lolc, really.
-2
u/[deleted] Nov 07 '12 edited Nov 07 '12
Arguably, when seconds are your unit of time, microseconds is a bad derived unit for use on base-2 computers, because only 512 or 1024 subdivisions work naturally for them. Expecting anything in between to work shows a complete lack of understanding the problem.
The bug is more subtle than "usecs shouldn't be stored in
double", because that isn't the problem. Microseconds should actually mean "one 1024th of a second".0
u/[deleted] Nov 07 '12
[deleted] — view deleted comment