Jump to content

Highlighting code and others


PHPiSean

Recommended Posts

Basically, I'm trying to take a string from the db and do two things.

[*]Prevent html from being processed as html (htmlspecialchars() i think)

[*]Recognize PHP code and highlight it.

 

This is a reply system much like what I'm typing right now. For example 2, I want to be able to do this

<?php
echo "hello";
?>

 

I've researched a little and found a function called highlight_php(). The problem I run into now is that I only want to highlight php when it is needed. I am stuck as to where to go next. My thoughts would be 2 regex functions, however I don't know which one to call first. Any suggestions? Everything is appreciated

Link to comment
https://forums.phpfreaks.com/topic/251412-highlighting-code-and-others/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.