|
Posted by harvey on 05/11/07 16:51
In article <1178901903.347883.242440@o5g2000hsb.googlegroups.com>,
matt.farey@gmail.com says...
> On 11 May, 17:38, harvey <harvey....@blueyonzders.com> wrote:
> > How do I get a text string that may contain HTML tags to
> > echo out to a web browser verbatim?
> >
> > IE I want the tags to be printed out - not interpreted.
> >
> > Thanks
> $string = '<h1>likethis</h1>';
>
> echo htmlentities( $string );
> //or
> echo highlight_string( '<?php' . $string . '?>' );
> //where adding <?php is a trick to highlight non-php, if you dont
> mind the php tags appearing.(u could kill them afterwards)
>
>
That was fast -
I am a bit red faced as I actually recognise that command but thought it
did something else !
Your second method is a new one to me - I will experiment with that.
thank you !
Navigation:
[Reply to this message]
|