If you’re looking for an easy way to highlight different types of source code in PHP, there’s a very simple class to help you: GeSHi – Generic Syntax Highlighter. It can display over 50 various coding languages in the appropriate syntax highlighting, with very easy options to manage it.
I’ve used it in various amounts of projects, including my own CodeBase system, for easy publishing of source code. You can find the source code (obviously it’s highlighted ;-) ) right here, on my projects page. It’s also used on the Nucleus Helpdesk pages, where various coding examples are giving for typical coding issues, such as retrieving data from a MS Access database in ASP, sending e-mail via ASP.NET, or adding a visitor counter to a website in PHP.
It can be used to highlight PHP, ASP, XML, (x)HTML, COBOL, Python, … It ranges from BlitzBasic to VHDL. It’s seriously worth taking a look at their website! And if you’re not convinced, they provide an online tool to test their highlighting.