note 99002 added to function.highlight-string
| From: | Zahlii at osu1 dot php dot net | Date: | Wed, 21 Jul 2010 16:07:25 +0000 |
| Subject: | note 99002 added to function.highlight-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-171020@lists.php.net to get a copy of this message | ||
Yet another snippet for Syntax-Highlighting with line-numbers
<style type="text/css">
body {
font-family:Consolas;
font-size:14px;
}
</style>
<?php
function display($c) {
$lines = explode("\n",$c);
$i=1;
$c2 = '<ol>';
foreach($lines as $line) {
if($i%5==0) $style='font-weight:bold;';
else $style = 'color:#666;';
$line_o = highlight_string("<?php ".$line,true);
$line_n =
str_replace(array("<?php ","<code>","</code>"),"",$line_o);
$c2 .= '<li style="'.$style.'"><span
style="font-weight:normal;">'.$line_n."</span></li>";
$i++;
}
echo $c2.'</ol>';
}
?>
display("< ?php echo 'Hello World!'; ?>;");
----
Server IP: 69.147.83.197
Probable Submitter: 79.227.141.210
----
Manual Page -- http://www.php.net/manual/en/function.highlight-string.php
Edit -- https://master.php.net/note/edit/99002
Del: integrated -- https://master.php.net/note/delete/99002/integrated
Del: useless -- https://master.php.net/note/delete/99002/useless
Del: bad code -- https://master.php.net/note/delete/99002/bad+code
Del: spam -- https://master.php.net/note/delete/99002/spam
Del: non-english -- https://master.php.net/note/delete/99002/non-english
Del: in docs -- https://master.php.net/note/delete/99002/in+docs
Del: other reasons-- https://master.php.net/note/delete/99002
Reject -- https://master.php.net/note/reject/99002
Search -- https://master.php.net/manage/user-notes.php