   (append
    php-font-lock-keywords-1
    (list
-    
+
     ;; class declaration
-    '("\\<\\(class\\|interface\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
+    '("[^_]\\<\\(class\\|interface\\)[ \t]*\\(\\(?:\\sw\\|\\s_\\)+\\)?"
       (1 font-lock-keyword-face) (2 font-lock-type-face nil t))
     ;; handle several words specially, to include following word,
     ;; thereby excluding it from unknown-symbol checks later

;; [Contributed by Gerrit Riessen]
(defvar php-imenu-generic-expression
 '(
   ("Functions"
    "^\\s-*function\\s-+\\([a-zA-Z0-9_]+\\)\\s-*(" 1)
   ("Classes"
    "^\\s-*class\\s-+\\([a-zA-Z0-9_]+\\)\\s-*" 1)
   )
 "Imenu generic expression for PHP Mode. See `imenu-generic-expression'."
 )

;; Add "foreach" to conditional introducing keywords
(defconst php-conditional-key nil)
(let ((all-kws "for\\|if\\|do\\|else\\|while\\|switch\\|foreach\\|elseif\\|try\\|finally\\|try\\|catch all")
      (front   "\\<\\(")
      (back    "\\)\\>[^_]"))
  (setq php-conditional-key (concat front all-kws back)))

(defconst php-class-kwds "class\\|interface")

(defconst php-class-key
  (concat
   "\\(" php-class-kwds "\\)\\s +"
   c-symbol-key				      ;name of the class
   "\\(\\s *extends\\s *" c-symbol-key "\\)?" ;maybe followed by superclass
   "\\(\\s *implements *[^{]+{\\)?"	      ;maybe the adopted protocols list
   ))

;; Create "default" symbol for GNU Emacs so that both XEmacs and GNU
;; emacs can refer to the default face by a variable named "default".
(unless (boundp 'default)
  (defvar default 'default))

;; Create faces for XEmacs
(unless (boundp 'font-lock-keyword-face)
  (copy-face 'bold 'font-lock-keyword-face))
(unless (boundp 'font-lock-constant-face)
  (copy-face 'font-lock-keyword-face 'font-lock-constant-face))

(provide 'php-mode)


       "endfor" "endforeach" "endif" "endswitch" "endwhile" "exit"
       "extends" "for" "foreach" "global" "if" "include" "include_once"
       "next" "or" "require" "require_once" "return" "static" "switch"
       "then" "var" "while" "xor" "private" "throw" "catch" "try"
       "instanceof" "catch all" "finally")))
  "PHP keywords.")

