Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
<?php
ini_set('highlight.comment', '#cc8800');
ini_set('highlight.default', '#6699cc');
ini_set('highlight.html','#000000');
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'];
}
}
?>
<html>
<head>
<title>PHP Syntax Highligher</title>
</head>
<body>
<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">
</form>
<hr>
<?php echo highlight_string($code, 1) ?>
</body>
</html>
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.