Hi guys, there are two very useful functions that you can use in your website if you would write some php tutorials. These functions are: highlight_string and highlight_file wich highlighting the php code.
For example:
The output will be something like this html:Code:highlight_string('<?php echo "Hello World!"; ?>');
and will display something like:HTML Code:<span style="color: rgb(0, 0, 187);"><?php </span><span style="color: rgb(0, 119, 0);">echo </span><span style="color: rgb(221, 0, 0);">"Hello World!"</span><span style="color: rgb(0, 119, 0);">; </span><span style="color: rgb(0, 0, 187);">?></span>
There's also:Code:<?php echo "Hello World!"; ?>
That do the same thing with a file.Code:highlight_file("filetohighlight.php");
I hope that you saw these functions for the first time and that this tutorial will be useful. Enjoy! Byez...![]()
Thanks for sharing. These functions make highlighting PHP very easy. For highlighting other languages, you can use GeSHi or Text_Highlighter from the Pear repos.
Nice little tutorial. Easy, informative and to the point. +rep
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks