Title: PHP Code Highlight?
Last modified: August 18, 2016

---

# PHP Code Highlight?

 *  AIMJournals
 * [21 years, 7 months ago](https://wordpress.org/support/topic/php-code-highlight/)
 * Well, I am a PHP developer myself, and my website is at [http://www.aim-journals.com.](http://www.aim-journals.com.)
   I was looking at wordpress and wondered if there was a way to post Highlighted
   PHP code. I figured out that you would have to do this manually because no such
   thing exists. However, there is a PHP function that will do this.
    If I knew 
   the workings of WordPress, I would edit it myself so that if I post `[PHP]$something
   = "yes"; if($something == "yes") { echo "yes"; }[/PHP] then it would take the
   code in between [PHP] and [/PHP] and put it into the string (for example) $php_str.
   Then I would have it do this code:  $php_str = "<?\n".$php_str."\n?".">"; $php_str
   = str_replace("$","\$",$php_str); $php_str = str_replace("\"","\\"",$php_str);
   $php_str = str_replace("'","\'",$php_str); $output_str = "<div style='margin:
   0px 5% 0px 5%;'>PHP:<hr />"; $output_str .= highlight_string($php_str,true); 
   $output_str .= "<hr /></div>";  and then it would replace [PHP]…[/PHP] with $
   output_str. If you see what I’m trying to do here, can anyone make a hack that
   would do this? If you need more explanation of to what I want, just tell me… 
   thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Mark (podz)](https://wordpress.org/support/users/podz/)
 * (@podz)
 * [21 years, 7 months ago](https://wordpress.org/support/topic/php-code-highlight/#post-84257)
 * This was posted today:
    [http://daryl.learnhouston.com/index.php?p=57](http://daryl.learnhouston.com/index.php?p=57)
   over at [http://www.weblogtoolscollection.com/](http://www.weblogtoolscollection.com/)
 *  Thread Starter Anonymous
 * [21 years, 7 months ago](https://wordpress.org/support/topic/php-code-highlight/#post-84268)
 * wow, thanks for that. I didn’t know it was that easy… however, I found a plugin
   that suits my needs… and then some…
    I was playing with this plugin, and didn’t
   post until now because I didn’t get it to fully work until now… the plugin I 
   used is called “iG:Syntax Highlighter” and works great, even has line numbers!
   Here’s a link: [http://blog.igeek.info/still-fresh/category/wp-plugins/igsyntax-hiliter/](http://blog.igeek.info/still-fresh/category/wp-plugins/igsyntax-hiliter/)
   Thanks for your help though.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘PHP Code Highlight?’ is closed to new replies.

## Tags

 * [Hiliter](https://wordpress.org/support/topic-tag/hiliter/)

 * 2 replies
 * 2 participants
 * Last reply from: Anonymous
 * Last activity: [21 years, 7 months ago](https://wordpress.org/support/topic/php-code-highlight/#post-84268)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
