public static function dateDiff($from, $to = null)
    {
        if (!$to) {
            $to = $from;
            $from = date("d/m/Y");
        }

        if (!$dateFrom = static::date("U", $from)) {
            return;
        }

        if (!$dateTo = static::date("U", $to)) {
            return;
        }

        $diff = $dateTo - $dateFrom;
        $days = round($diff / 86400);

        return $days;
    }
public static function dateDiff($from, $to = null)
    {
        if (!$to) {
            $to = $from;
            $from = date("d/m/Y");
        }

        if (!$dateFrom = static::date("U", $from)) {
            return;
        }

        if (!$dateTo = static::date("U", $to)) {
            return;
        }

        $diff = $dateTo - $dateFrom;
        $days = round($diff / 86400);

        return $days;
    }
public static function dateDiff ( $ from , $ to = null ) { if ( ! $ to ) { $ to = $ from ; $ from = date ( "d/m/Y" ) ; } if ( ! $ dateFrom = static :: date ( "U" , $ from ) ) { return ; } if ( ! $ dateTo = static :: date ( "U" , $ to ) ) { return ; } $ diff = $ dateTo - $ dateFrom ; $ days = round ( $ diff / 86400 ) ; return $ days ; }
Compare two dates and return an integer representing their difference in days.
Returns null if any of the parsing fails.

@param string|int $from The first date to parse
@param string|int $to The second date to parse

@return int|null
Compare two dates and return an integer representing their difference in days . Returns null if any of the parsing fails .