PHP Classes

PHP color: Format PHP code as colored HTML

Recommend this page to a friend!
  Info   Screenshots Screenshots   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 55%Total: 861 All time: 4,061 This week: 120Up
Version License PHP version Categories
phpcolor 1.0Freeware5.0HTML, PHP 5, Text processing


This class can be used to format PHP code as colored HTML independent of the PHP code version.

It takes a string of PHP code and reformats it by adding HTML tags that can render the PHP constructs using different colors.

The PHP code text reformatting uses only regular expression replacement.

Innovation Award
PHP Programming Innovation award nominee
August 2008
Number 2

Prize: One book of choice from Manning
PHP provides built-in support to display PHP code with highlighted syntax.

However, if you want to highlight code for PHP 5 or later using PHP 4, it may not work, as the highlighting functions may fail because PHP 5 syntax is invalid under PHP 4.

This class provides an alternative solution based on replacing code with syntax highlighting tags using PHP version independent regular expressions.

Manuel Lemos
Picture of hazem ali
Name: hazem ali <contact>
Classes: 1 package by
Country: Egypt Egypt
Age: 39
All time rank: 255925 in Egypt Egypt
Week rank: 341 Up5 in Egypt Egypt Up
Innovation award
Innovation award
Nominee: 1x

  • screenshot
  Files folder image Files  
File Role Description
Accessible without login Plain text file example.php Example test
Plain text file phpcolor.php Class class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:4,061
This week:120Up
User Ratings User Comments (2)
 All time
Overall, it's sufficient.
15 years ago (Tim White)
Very nice idea, already saw something of this type on perl bu...
15 years ago (David Ferreira)