Bug #52242 [Opn]: DateTime::diff affects round()
| From: | hrach dot cz at gmail dot com | Date: | Sat, 03 Jul 2010 15:18:50 +0000 |
| Subject: | Bug #52242 [Opn]: DateTime::diff affects round() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-152056@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52242&edit=1
ID: 52242
User updated by: hrach dot cz at gmail dot com
Reported by: hrach dot cz at gmail dot com
Summary: DateTime::diff affects round()
Status: Open
Type: Bug
Package: Date/time related
Operating System: win7 x86
PHP Version: 5.3.2
New Comment:
I copied old version of definition $t, should be:
$t = new DateTime('2010-08-03');
Previous Comments:
------------------------------------------------------------------------
[2010-07-03 17:14:58] hrach dot cz at gmail dot com
Description:
------------
If I use diff method (doesn't matter on which variable),
usually (unfortunatelly not allways) round function returned some char
(@, U, :, <, ...)
I was not able to realize cases. :(
Test script:
---------------
<?php
$t = new DateTime();
$s = new DateTime('2010-08-01');
$diff = $t->diff($s, true)->format('%d');
echo $diff ."\n";
$var = 98232923;
$mod = 82342;
$dur = round($var / $mod);
echo $dur;
Expected result:
----------------
2
1193
Actual result:
--------------
2
Å®
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52242&edit=1