MasterACE14 Posted November 3, 2007 Share Posted November 3, 2007 Evening Everyone, I am using the highlight_syntax() function for some code, and it works fine, I echo it, and it shows the code highlighted, but it also echo's a 1 after all the code. Why is that? I've tried substr() to remove it with no success. Regards ACE Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/ Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 some code would help Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/#findComment-384095 Share on other sites More sharing options...
MasterACE14 Posted November 3, 2007 Author Share Posted November 3, 2007 <?php $heading = highlight_string("<?php echo \"Persons Name Subject\"; ?> "); echo $heading; ?> its displaying this: <?php echo "Persons Name Subject"; ?> 1 Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/#findComment-384097 Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 try $heading = highlight_string("<?php echo \"Persons Name Subject\"; ?> ",TRUE); echo $heading; Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/#findComment-384099 Share on other sites More sharing options...
MasterACE14 Posted November 3, 2007 Author Share Posted November 3, 2007 doesn't echo anything then :-\ and if I try FALSE instead of TRUE, it echo's it with the 1 still. Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/#findComment-384104 Share on other sites More sharing options...
thebadbad Posted November 3, 2007 Share Posted November 3, 2007 Remove the echo; the function will output itself if TRUE is not specified. <?php highlight_string("<?php echo \"Persons Name Subject\"; ?> "); ?> EDIT: But if you wanna save the string in a variable, and then echo it out, this works fine for me (TRUE makes the function return the highlighted string instead of outputting it): <?php $str = highlight_string("<?php echo \"Persons Name Subject\"; ?>", TRUE); echo $str; ?> Link to comment https://forums.phpfreaks.com/topic/75891-highlight_syntax-displays-1-after-the-function/#findComment-384107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.