Foser Posted November 7, 2007 Share Posted November 7, 2007 I'm looking for a function which will take a text variable and outputs it with the php colours. Is there such functions? Thanks Quote Link to comment Share on other sites More sharing options...
obsidian Posted November 7, 2007 Share Posted November 7, 2007 Check out the highlight_string() function. Notice especially the second parameter. If it is set to TRUE, the colored string is returned, but if it is not, it is automatically output to the screen. <?php $string = "<?php echo \"Hello, World!\"; ?>"; $out = highlight_string($string, TRUE); echo $string; ?> Quote Link to comment Share on other sites More sharing options...
Foser Posted November 7, 2007 Author Share Posted November 7, 2007 Thanks alot! works great! although we need to echo $out variable. Quote Link to comment Share on other sites More sharing options...
wildteen88 Posted November 7, 2007 Share Posted November 7, 2007 change echo $string; to echo $out; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.