![]() |
On an interesting note
PHP Code:
Curiously, I got a negative number for this - PHP breaking the rules of math? |
What do
$endDate and $startDate equal? What makes you think it's breaking the rules of mathematics? |
no matter what $endDate and $startDate equate to, abs() should make it positive. the absolute value of a negative is a positive.
|
When I do this, I get a positive number of 10.
$startDate = "20 September 2000"; $endDate = "10 September 2000"; $test = abs(ceil((strtotime($endDate) - strtotime($startDate)) / 86400)); echo $test; |
Either your abs function is not working or something is happening to the data between the assigning and output. No real number can have a negative absolute value, an exception would have been thrown.
|
try to do it manually, see if it produces the same result, if not there may be somethings b0rked with abs, don't quite know what mind you, but just limit the possible avenues of error.
PHP Code:
|
To be frank, this thread is pointless unless it can be repeated. Does that code still return negative? What were the values of $startDate and $endDate which returned the negative value?
|
| All times are GMT. The time now is 10:21 AM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0