public static function getSecondsFromInterval(DateInterval $interval)
    {
        $map   = [31536000, 2592000, 86400, 3600, 60, 1];
        $parts = explode('.', $interval->format('%y.%m.%d.%h.%i.%s'));
        $value = 0;

        foreach ($parts as $key => $val) {
            $value+= $val * $map[$key];
        }

        return $value;
    }
public static function getSecondsFromInterval(DateInterval $interval)
    {
        $map   = [31536000, 2592000, 86400, 3600, 60, 1];
        $parts = explode('.', $interval->format('%y.%m.%d.%h.%i.%s'));
        $value = 0;

        foreach ($parts as $key => $val) {
            $value+= $val * $map[$key];
        }

        return $value;
    }
public static function getSecondsFromInterval ( DateInterval $ interval ) { $ map = [ 31536000 , 2592000 , 86400 , 3600 , 60 , 1 ] ; $ parts = explode ( '.' , $ interval -> format ( '%y.%m.%d.%h.%i.%s' ) ) ; $ value = 0 ; foreach ( $ parts as $ key => $ val ) { $ value += $ val * $ map [ $ key ] ; } return $ value ; }
Returns the seconds of an DateInterval recalculating years, months etc.

@param DateInterval $interval
@return integer
Returns the seconds of an DateInterval recalculating years months etc .