Show PHP Code
Demonstration des Moduls Show PHP Code
Zum Download >>
Der folgende PHP Code ist mit diesem Modul optisch aufgewertet worden.
<?php
/**
* Highlight für die Syntax eines Quelltextes, mit Zeilennummern.
*
* @param string $file
* @param bool[optional] $return
*
* @return bool or string
*/
function highlight_file_numbered($file, $return=false) {
$source = highlight_file($file,1);
$source = explode("<br />", $source);
$o = "<ol>\r\n";
if (!$return) {
echo $o;
$o = '';
}
foreach ($source as $line) {
$line = trim($line,"\r\n");
$o .= "<li></li>\r\n";
if (!$return) {
echo $o;
$o = '';
}
}
$o .= "</ol>\r\n";
if (!$return) {
echo $o;
$o = true;
}
return $o;
}
?>
Diesen und viele weitere PHP-Code Schnipsel kann man auf phpfreaks.com finden.
|