On 10/12/12 13:35, Christian Stoller wrote:
> Hm... I know '$date->add(new DateInterval('P15D'));' is possible, but it has 
> the same problem.
>
> I have to write:
>
> $date = new DateTime()
> $date->add(new DateInterval('P' . getDaysToAddMethod() . 'D'));
>
> I think it is very hard to read. Or is it just my personal point of view?
I agree it's unintuitive.

Rather than the original:

 $date->modify(15, DateTime::INTERVAL_DAY);

What about adding such option to DateInterval constructor?

new DateInterval(DateTime::INTERVAL_DAY, 15);

Or maybe: new DateInterval( array( DateTime::INTERVAL_DAY=> 15 ) );


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to