The only NATIVE way is using strip_tags(), and physically allowing most HTML
tags to be included:


$allowed = 
"<A><B><I><HTML><HEAD><SCRIPT><BODY><A><BR><HR><P><H1><H2><META><TABLE><TR><
TD><THEAD> etc etc";
$html = strip_tags($html, $allowed);

In other words, I think you're better off with a regexp on this occasion.


Second option:  Depending on your code, something like:

$html = str_replace('<?','<!--',$html);
$html = str_replace('?>','-->',$html);

MIGHT comment out all your PHP, but I'm thinking that it will depend greatly
on your coding style, and is really just a quick hack.

Justin French


on 13/08/02 3:35 AM, Remy Dufour ([EMAIL PROTECTED]) wrote:

> Hi all,
> 
> Is there an easy way to remove <?php...?> tag from a string ?
> Ive got this script and i want it to output only html...
> I know i can do this with regular expression but i wonder if there are some
> native function to do the job.
> 
> <?php
> $out = implode("\n", file ($_SERVER['PATH_TRANSLATED']));
> echo function_to_remove_php_tags($out);
> exit();
> ?>
> <html>
> <head>
> <title>Test</title>
> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
> </head>
> <body bgcolor="#FFFFFF" text="#000000">
> Hello !!!
> </body>
> </html>
> 
> Regards !
> 
> Rémy Dufour
> 


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to