Einzelnen Beitrag anzeigen
Alt 23.02.2005, 17:02  
Gast
 
Beiträge: n/a
Standard

Zitat:
Zitat von Corvin Gröning
Beispiel für die Anwendung von highlight_string():

<?php
function php_string($text){
$text = stripslashes($text);
ob_start();
highlight_string($text);
$text = ob_get_contents();
ob_end_clean();
return $text;
}

$text = '
PHP-Code:
<?php echo "Hallo!" ?>
';


$text = preg_replace("/\[php\](.*)\[\/php\]/esiU", "php_string('$1')", $text);
echo $text;
?>


Danke