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 Link to comment https://forums.phpfreaks.com/topic/76385-solved-php-color-function/ 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; ?> Link to comment https://forums.phpfreaks.com/topic/76385-solved-php-color-function/#findComment-386744 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. Link to comment https://forums.phpfreaks.com/topic/76385-solved-php-color-function/#findComment-386752 Share on other sites More sharing options...
wildteen88 Posted November 7, 2007 Share Posted November 7, 2007 change echo $string; to echo $out; Link to comment https://forums.phpfreaks.com/topic/76385-solved-php-color-function/#findComment-387043 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.