Created
February 20, 2013 09:14
-
-
Save beberlei/4994193 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function datemanip(DateTime $dt) | |
{ | |
return $dt->modify("+2 day"); | |
} | |
$dt = new DateTime(); | |
$dti = new DateTimeImmutable(); | |
datemanip($dt); // BUG! | |
datemanip($dti); | |
function datemanip_fixed(DateTime $dt) | |
{ | |
return clone $dt->momdify("+2 day"); // no difference to pre 5.5 code | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment