0

I'm looking for a solution where users can copy/paste PHP code into a textbox and it will be highlighted like it is inside an IDE. (Like stackoverflow does when you paste a code snippet) Any links/ideas/more information would be appreciated.

4 Answers 4

2

Check out GeSHi. It does almost everything for you.

Sign up to request clarification or add additional context in comments.

Comments

2

You can use PHP's highlight_string

Very simple example...

<form action="" method="post">
<textarea name="str"></textarea>
<input type="submit">
</form>
<?php
highlight_string($_POST['str']);
?>

Comments

1

http://phpanywhere.net/

Comments

0

Two sites that I use are gist.github.com and codepad.org. You might want to check out what libraries they're using, or just take advantage of their sites and avoid the work yourself by linking through to 'em.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.