Re: strip_tags
| From: | Frank Arensmeier | Date: | Sat, 20 Jul 2013 21:34:13 +0000 |
| Subject: | Re: strip_tags | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-321662@lists.php.net to get a copy of this message | ||
20 jul 2013 kl. 18:25 skrev Tedd Sperling <tedd@sperling.com>:
> Hi gang:
>
> I've been using
>
> $str = strip_tags($str, $allowable)
>
> as it is described via the manuals:
>
> http://php.net/manual/en/function.strip-tags.php
>
> The problem I've found is the tags "<br>" and "<br />" are
> not stripped.
>
> How do you strip all tags, but leave some tags (such as <b>, <i>, and <u> --
> I know these are depreciated, but my client wants them anyway).
>
From the manual:
allowable_tags
You can use the optional second parameter to specify tags which should not be stripped.
Note:
HTML comments and PHP tags are also stripped. This is hardcoded and can not be changed with
allowable_tags.
Note:
This parameter should not contain whitespace. strip_tags() sees a tag as a case-insensitive string
between < and the first whitespace or >. It means that strip_tags("<br/>",
"<br>") returns an empty string.
It's all there… ;-)
Cheers,
/frank
> Cheers,
>
> tedd
>
> _____________________
> tedd@sperling.com
> http://sperling.com
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>