showing syntax highlighted source


Want to display PHP code with syntax highlighting (colors). This helps with debugging, etc.



Within PHP you can nicely display colorful text, which can be very useful for debugging or just to showcase your code.

We simply use the highlight_file function within PHP, like this below.



<?php highlight_file(“transform.php”); ?>

For a real-life demo, take a look here:



[tags]PHP Syntax Highlighting, PHP Coding School[/tags]


If you have found my website useful, please consider buying me a coffee below 😉

Leave a Reply

Your email address will not be published. Required fields are marked *