|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-07-24 21:41 UTC] yann at protonicdesign dot com
According to me highlight_string should allow you to highlight a string that does not necessairly start with <?php or <? For the simple reason, that i want to read a file, line by line to return the line number, then the code. Or there should be a feature in highlight_file so that it returns line numbers. It is a details but it could be usefull. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 04:00:02 2025 UTC |
Hi, highlight_* functions only highlight php code, because php code can be mixed with normal text or HTML. That said, I like the feature request, like so: highlight_string(string $source, bool $show_linenumbers) FYI, it can be done like so: <?php ob_start(); highlight_string($source); $out = ob_get_contents(); ob_end_clean(); $lines = explode("<br />", $out); for($i=0; $i<count($lines);$i++) { //needs tweaking of the font colors/tags printf("%03d: %s<br />", $i+1, $lines[$i]); } ?>