src/DateTime/DateInterval.php
public function toSeconds()
    {
        $seconds = $this->s;
        $seconds += $this->i * 60;
        $seconds += $this->h * 3600;
        
        if ($this->days) {
            $seconds += $this->days * 86400;
        } else {
            if ($this->d) {
                $seconds += $this->d * 86400;
            }
            if ($this->m) {
                trigger_error('Calculating seconds for interval with months property. Result may not be accurate.', E_USER_WARNING);
                $seconds += 2629800;
            }
            if ($this->y) {
                trigger_error('Calculating seconds for interval with years property. Result may not be accurate.', E_USER_WARNING);
                $seconds += $this->y * 31557600;
            }
        }
        return $seconds;
    }
public function toSeconds()
    {
        $seconds = $this->s;
        $seconds += $this->i * 60;
        $seconds += $this->h * 3600;
        
        if ($this->days) {
            $seconds += $this->days * 86400;
        } else {
            if ($this->d) {
                $seconds += $this->d * 86400;
            }
            if ($this->m) {
                trigger_error('Calculating seconds for interval with months property. Result may not be accurate.', E_USER_WARNING);
                $seconds += 2629800;
            }
            if ($this->y) {
                trigger_error('Calculating seconds for interval with years property. Result may not be accurate.', E_USER_WARNING);
                $seconds += $this->y * 31557600;
            }
        }
        return $seconds;
    }
public function toSeconds ( ) { $ seconds = $ this -> s ; $ seconds += $ this -> i * 60 ; $ seconds += $ this -> h * 3600 ; if ( $ this -> days ) { $ seconds += $ this -> days * 86400 ; } else { if ( $ this -> d ) { $ seconds += $ this -> d * 86400 ; } if ( $ this -> m ) { trigger_error ( 'Calculating seconds for interval with months property. Result may not be accurate.' , E_USER_WARNING ) ; $ seconds += 2629800 ; } if ( $ this -> y ) { trigger_error ( 'Calculating seconds for interval with years property. Result may not be accurate.' , E_USER_WARNING ) ; $ seconds += $ this -> y * 31557600 ; } } return $ seconds ; }
Convert interval to number of seconds
@return integer
Convert interval to number of seconds