highlight_string()
Posted: Thu Sep 16, 2004 9:55 am
Hey there,
I wanted to display PHP code like used on these forums (the old version though) and i found a function called highlight_string() which i thought worked perfect to what i wanted. When i tried it i found out that no matter what i do, if u put a var in it, eg highlight_string("$_REQUEST['var']");, all that it shows is either the contents of the var if it is set elsewhere on the page (eg On my site i use index.php?p=tutorials, then i wanted to make a tutorial of how i did them, but if i put if (isset($_REQUEST['p'])) it replaces it with 'tutorials'). Also if the var has no value (i tried just using $page instead) it just displays nothing.
Is there anyway to fix this ? or should i find a different way of doing it ?
Thx
// Getran
I wanted to display PHP code like used on these forums (the old version though) and i found a function called highlight_string() which i thought worked perfect to what i wanted. When i tried it i found out that no matter what i do, if u put a var in it, eg highlight_string("$_REQUEST['var']");, all that it shows is either the contents of the var if it is set elsewhere on the page (eg On my site i use index.php?p=tutorials, then i wanted to make a tutorial of how i did them, but if i put if (isset($_REQUEST['p'])) it replaces it with 'tutorials'). Also if the var has no value (i tried just using $page instead) it just displays nothing.
Is there anyway to fix this ? or should i find a different way of doing it ?
Thx
// Getran