note 90378 added to function.highlight-string

From: Date: Sun, 19 Apr 2009 04:45:52 +0000
Subject: note 90378 added to function.highlight-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-153480@lists.php.net to get a copy of this message
<style type="text/css"> .linenum{ text-align:right; background:#FDECE1; border:1px solid #cc6666; padding:0px 1px 0px 1px; font-family:Courier New, Courier; float:left; width:17px; margin:3px 0px 30px 0px; } code {/* safari/konq hack */ font-family:Courier New, Courier; } .linetext{ width:700px; text-align:left; background:white; border:1px solid #cc6666; border-left:0px; padding:0px 1px 0px 8px; font-family:Courier New, Courier; float:left; margin:3px 0px 30px 0px; } br.clear { clear:both; } </style> <? function printCode($code, $lines_number = 0) { if (!is_array($code)) $codeE = explode("\n", $code); $count_lines = count($codeE); $r1 = "Code:<br />"; if ($lines_number){ $r1 .= "<div class=\"linenum\">"; foreach($codeE as $line =>$c) { if($count_lines=='1') $r1 .= "1<br>"; else $r1 .= ($line == ($count_lines - 1)) ? "" : ($line+1)."<br />"; } $r1 .= "</div>"; } $r2 = "<div class=\"linetext\">"; $r2 .= highlight_string($code,1); $r2 .= "</div>"; $r .= $r1.$r2; echo "<div class=\"code\">".$r."</div>\n"; } printCode('<? echo "PHP Code" ?> ',1); ?> by mean Share idea. good luck ^_^ ---- Server IP: 203.121.145.123 Probable Submitter: 118.172.226.23 ---- Manual Page -- http://www.php.net/manual/en/function.highlight-string.php Edit -- https://master.php.net/note/edit/90378 Del: integrated -- https://master.php.net/note/delete/90378/integrated Del: useless -- https://master.php.net/note/delete/90378/useless Del: bad code -- https://master.php.net/note/delete/90378/bad+code Del: spam -- https://master.php.net/note/delete/90378/spam Del: non-english -- https://master.php.net/note/delete/90378/non-english Del: in docs -- https://master.php.net/note/delete/90378/in+docs Del: other reasons-- https://master.php.net/note/delete/90378 Reject -- https://master.php.net/note/reject/90378 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#153480) next »