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 Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted November 3, 2007 Share Posted November 3, 2007 some code would help Quote Link to comment 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 Quote Link to comment 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; Quote Link to comment 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. Quote Link to comment 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; ?> 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.