[New post] HOWTO: Highlight PHP and JavaScript Code with PHP

Posted by | Posted on 11:33

HOWTO: Highlight PHP and JavaScript Code with PHP

Bogdan Michka | February 22, 2010 at 1:32 pm | Tags: code, highlight, howto, javascript, php | Categories: development, tips-n-tricks, web | URL: http://wp.me/pHbzX-dY

From the article:

Highlight PHP and JavaScript Code with PHP | CSS-Tricks

PHP has a cool function that automatically highlights PHP code called highlight_string(); Theoretically this could be used to roll your own code highlighting on a site, rather than rely on JavaScript or some kind of external service to do it. In this article I'll show you the basics of how it works, then extended it with a few tricks. Since JavaScript is so similar to PHP in syntax, we can trick the function into highlighting JavaScript code as well. Then finally how we can bust out some smarts to auto-tab the code.

Add a comment to this post


Comments (0)

Post a Comment