Jump to content

highlight_syntax() displays 1 after the function


MasterACE14

Recommended Posts

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
Share on other sites

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.