Skip to content

Instantly share code, notes, and snippets.

@beberlei
Created February 20, 2013 09:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save beberlei/4994193 to your computer and use it in GitHub Desktop.
Save beberlei/4994193 to your computer and use it in GitHub Desktop.
<?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