Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. Which of the following statements can be used to add two months to the existing date?

  2. A.

     $date->modify(‘+2 months’);

    B.

     $date = modify(‘+2 months’);

    C.

     $date = modify(‘2+ months’);

    D.

     $date->modify(‘2+ months’);

    View Answer

    Workspace

    Answer : Option A

    Explanation :

    To change the date stored by a DateTime object after it has been created, you use DateTime::modify() with a natural language expression.


Be The First To Comment