Save codes as is where is?

Let say

I wrote these codes below inside a textarea.

Below are codes for testing…?

public function test123
    for() {

How do I save these codes in mysql and show it again on the php page,
and retain it’s identation format etc… as is where is?

What are the functions? or codes use in php?
to do this?

Thanks in advance.

It sounds like you’re looking for a syntax highlighter along the lines of Prism. You could take a look at that and see if it would be usable for you. My own experience of it has been good - I use it as a plugin on b2evolution which is PHP based. Take a look.


thanks for that prism suggestion.
But I need simple solution, is there a php built-in function that will solve this easy problem?

problem solved.



<pre> </pre>

prism is interesting will look at it later when needs arise.

Prism looks very interesting as relatively lightweight JavaScript highlighter.

I’ve used PHP’s highlight function before, but not for a while.

1 Like

Interesting function there. I’d not have expected a language to have something like that built in by default. You learn something new every day.

I you save your PHP file with the extension PHPS and view it in a browser it will display the highlighted PHP codes - works in and Chrome.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.