Generic Syntax Highlighting For PHP

Want to help support this blog? Try out Oh Dear, the best all-in-one monitoring tool for your entire website, co-founded by me (the guy that wrote this blogpost). Start with a 10-day trial, no strings attached.

We offer uptime monitoring, SSL checks, broken links checking, performance & cronjob monitoring, branded status pages & so much more. Try us out today!

Profile image of Mattias Geniar

Mattias Geniar, July 26, 2008

Follow me on Twitter as @mattiasgeniar

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.



Want to subscribe to the cron.weekly newsletter?

I write a weekly-ish newsletter on Linux, open source & webdevelopment called cron.weekly.

It features the latest news, guides & tutorials and new open source projects. You can sign up via email below.

No spam. Just some good, practical Linux & open source content.