PHP code to HTML conversion

The following PHP script might be helpful to anyone who wishes to publish PHP tutorials or who wishes to publish PHP code on a HTML webpage.

Tool Use Instruction:
Copy & Paste your source code (can either be purely PHP, or a HTML file containing PHP) in the box below and click on "Convert PHP to HTML button.  You may check "Output line numbers" checkbox to output line numbers in the converted code.



Output line numbers

You will see the converted code in the same box above.  To do another conversion, just clear the box, Copy & Paste the code in the box above and hit "Convert PHP to HTML" again.

What the script does:
The script simply replaces all the "<" to "&lt;", ">" to "&gt;", tabs to 5 spaces, and spaces to "&nbsp"

Here is the source code: