public function getDuration()
    {
        if ($this->duration === null) {
            $match = [];
            preg_match(self::$REGEX_DURATION, $this->output, $match);
            if (array_key_exists(1, $match) && array_key_exists(2, $match) && array_key_exists(3, $match)) {
                $hours = (int)$match[1];
                $minutes = (int)$match[2];
                $seconds = (int)$match[3];
                $fractions = (float)(array_key_exists(5, $match) ? '0.'.$match[5] : 0.0);

                $this->duration = (($hours * 3600) + ($minutes * 60) + $seconds + $fractions);
            } else {
                $this->duration = 0.0;
            }

            return $this->duration;
        }

        return $this->duration;
    }
public function getDuration()
    {
        if ($this->duration === null) {
            $match = [];
            preg_match(self::$REGEX_DURATION, $this->output, $match);
            if (array_key_exists(1, $match) && array_key_exists(2, $match) && array_key_exists(3, $match)) {
                $hours = (int)$match[1];
                $minutes = (int)$match[2];
                $seconds = (int)$match[3];
                $fractions = (float)(array_key_exists(5, $match) ? '0.'.$match[5] : 0.0);

                $this->duration = (($hours * 3600) + ($minutes * 60) + $seconds + $fractions);
            } else {
                $this->duration = 0.0;
            }

            return $this->duration;
        }

        return $this->duration;
    }
public function getDuration ( ) { if ( $ this -> duration === null ) { $ match = [ ] ; preg_match ( self :: $ REGEX_DURATION , $ this -> output , $ match ) ; if ( array_key_exists ( 1 , $ match ) && array_key_exists ( 2 , $ match ) && array_key_exists ( 3 , $ match ) ) { $ hours = ( int ) $ match [ 1 ] ; $ minutes = ( int ) $ match [ 2 ] ; $ seconds = ( int ) $ match [ 3 ] ; $ fractions = ( float ) ( array_key_exists ( 5 , $ match ) ? '0.' . $ match [ 5 ] : 0.0 ) ; $ this -> duration = ( ( $ hours * 3600 ) + ( $ minutes * 60 ) + $ seconds + $ fractions ) ; } else { $ this -> duration = 0.0 ; } return $ this -> duration ; } return $ this -> duration ; }
Return the duration of a movie or audio file in seconds.

@return float Movie duration in seconds.
Return the duration of a movie or audio file in seconds .