<?php
$tz = new DateTimeZone('Europe/Amsterdam');
$now = new DateTime('2015-10-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 9, $diff->format('%m'));
$now = new DateTime('2015-09-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 8, $diff->format('%m'));
$now = new DateTime('2015-11-01', $tz);
$then = new DateTime('2015-01-01', $tz);
$diff = $now->diff($then);
echo sprintf("Expected: %d. Returned: %d\n", 10, $diff->format('%m'));
- Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
- Expected: 9. Returned: 9
Expected: 8. Returned: 8
Expected: 10. Returned: 10
- Output for 5.4.2 - 5.4.45, 5.5.24 - 5.5.35, 5.6.7 - 5.6.21, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30
- Expected: 9. Returned: 8
Expected: 8. Returned: 8
Expected: 10. Returned: 10
preferences:
154.39 ms | 404 KiB | 223 Q