Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
ini_set('highlight.comment', '#cc8800');
ini_set('highlight.default', '#6699cc');
ini_set('highlight.keyword', '#993333');
ini_set('highlight.string', '#66cc66');
$code = '';
if (isset ($_POST['code'])) {
$code = $_POST['code'];
if (0 === preg_match('/^(\<\?php).*/', $_POST['code'])) {
$code = '<?php' . PHP_EOL . $_POST['code'];
<title>PHP Syntax Highligher</title>
<form name="highlight" action="<?php echo $_SERVER['PHP_SELF'] ?>" method="post">
<textarea name="code" id="code" rows="12" cols="40"><?php echo $code ?></textarea>
<input type="submit" value="Highlight">
<?php echo highlight_string($code, 1) ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.