src/Duration.php
public function toSeconds($duration = null, $precision = false)
    {
        if (null !== $duration) {
            $this->parse($duration);
        }
        $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;

        return $precision !== false ? round($this->output, $precision) : $this->output;
    }
public function toSeconds($duration = null, $precision = false)
    {
        if (null !== $duration) {
            $this->parse($duration);
        }
        $this->output = ($this->days * $this->hoursPerDay * 60 * 60) + ($this->hours * 60 * 60) + ($this->minutes * 60) + $this->seconds;

        return $precision !== false ? round($this->output, $precision) : $this->output;
    }
public function toSeconds ( $ duration = null , $ precision = false ) { if ( null !== $ duration ) { $ this -> parse ( $ duration ) ; } $ this -> output = ( $ this -> days * $ this -> hoursPerDay * 60 * 60 ) + ( $ this -> hours * 60 * 60 ) + ( $ this -> minutes * 60 ) + $ this -> seconds ; return $ precision !== false ? round ( $ this -> output , $ precision ) : $ this -> output ; }
Returns the duration as an amount of seconds.

For example, one hour and 42 minutes would be "6120"

@param  int|float|string $duration A string or number, representing a duration
@param  int|bool $precision Number of decimal digits to round to. If set to false, the number is not rounded.
@return int|float
Returns the duration as an amount of seconds .