function htmlBegin($s) { $matches = array(); $result = preg_match($this->openTag('html'), $s, $matches, PREG_OFFSET_CAPTURE); if ($result === false || !$matches) { return false; } // Return the offset of the first match. return $matches[0][1]; }