note 77535 added to function.highlight-string
| From: | dark_messenger84 at yahoo dot co dot uk | Date: | Sun, 02 Sep 2007 20:31:21 +0000 |
| Subject: | note 77535 added to function.highlight-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-130108@lists.php.net to get a copy of this message | ||
Here's an improved version of supremacy2k at gmail dot com's code. It's a small
function that accepts either PHP syntax in plain text or from another script, and then parses it
into an ordered list with syntax highlighting.
<?php
function print_php_code($str, $type) {
switch ($type) {
case "text":
$str = highlight_string($str, true);
break;
case "file":
$str = highlight_file($str, true);
break;
}
$str = explode("<br />", $str);
echo "<div>";
echo "<ol>\n";
foreach ($str as $line => $syntax) {
echo "<li><code>" . $syntax . "</code></li>";
}
echo "</ol>\n";
echo "</div>";
}
?>
----
Server IP: 194.145.210.3
Probable Submitter: 86.14.195.73
----
Manual Page -- http://www.php.net/manual/en/function.highlight-string.php
Edit -- https://master.php.net/note/edit/77535
Del: integrated -- https://master.php.net/note/delete/77535/integrated
Del: useless -- https://master.php.net/note/delete/77535/useless
Del: bad code -- https://master.php.net/note/delete/77535/bad+code
Del: spam -- https://master.php.net/note/delete/77535/spam
Del: non-english -- https://master.php.net/note/delete/77535/non-english
Del: in docs -- https://master.php.net/note/delete/77535/in+docs
Del: other reasons-- https://master.php.net/note/delete/77535
Reject -- https://master.php.net/note/reject/77535
Search -- https://master.php.net/manage/user-notes.php