(int)@ $matches[2], 'days'=> (int)@ $matches[4], 'hours'=> (int)@ $matches[7], 'minutes'=>(int)@ $matches[9], 'seconds'=>(int)@ $matches[11] ); $ts += $results['seconds']; $ts += 60 * $results['minutes']; $ts += 60 * 60 * $results['hours']; $ts += 24 * 60 * 60 * $results['days']; $ts += 7 * 24 * 60 * 60 * $results['weeks']; } else { // Invalid duration! } $dir = ($duration{0} == '-') ? -1 : 1; $this->dur = $dir * $ts; } /** * Returns the duration in seconds * @return int */ public function getDuration() { return $this->dur; } }