How to get number of days between two given dates using PHP ?

  • Posted by Sharad Jaiswal

    <?php
    $tomorrow = mktime(0, 0, 0, date(“m”) , date(“d”)+1, date(“Y”));
    $lastmonth = mktime(0, 0, 0, date(“m”)-1, date(“d”), date(“Y”));
    echo ($tomorrow-$lastmonth)/86400;
    ?>

Please Login or Register to leave a response.

Related Questions

Core PHP Interview Questions

What is T_PAAMAYIM_NEKUDOTAYIM ?

T_PAAMAYIM_NEKUDOTAYIM is scope resolution operator used as :: (double colon) .Basically, it used to call static methods/variables of a Class...

Core PHP Interview Questions

What is the difference between == and === operator in PHP ?

In PHP == is equal operator and returns TRUE if $a is equal to $b after type juggling and === is Identical operator and return TRUE if $a is equal to $b, and they are of the same data type...