|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2001-07-12 20:32 UTC] michel at eevolved dot com
$foo = strip_tags("< < <b>hello</b>", "<b>");
echo $foo; // prints "< b>hello" with a hidden "</b>"
strip_tags(), in this case, returns the string it was
supplied, but omits the second and third '<' character. In
a regular browser, it would display the 3 '<' characters,
seperated by spaces: "< < <" (equivalent to "< <
<") followed by a bold hello. Yet since PHP probably
raises a flag after the first "<", all subsequent "<"
characters are ignored until the next ">".
To resume:
Source witSource without strip_tags: "< < <b>hello</b>"
Source with strip_tags: "< b>hello</b>"
hout strip_tags: "< < <b>hello</b>"
Source with strip_tags: "< b>hello</b>"
I would also like to point out:
$foo = strip_tags("< < < >hello</b>", "<b>");
echo $foo;
Source without strip_tags: "< < < >hello</b>"
Source with strip_tags: "hello</b>"
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 11:00:01 2025 UTC |
$foo = strip_tags("< < <b>hello</b>", "<b>"); echo $foo; // prints "< b>hello" with a hidden "</b>" strip_tags(), in this case, returns the string it was supplied, but omits the second and third '<' character. In a regular browser, it would display the 3 '<' characters, seperated by spaces: "< < <" (equivalent to "< < <") followed by a bold hello. Yet since PHP probably raises a flag after the first "<", all subsequent "<" characters are ignored until the next ">". To resume: Source witSource without strip_tags: "< < <b>hello</b>" Source with strip_tags: "< b>hello</b>" I would also like to point out: $foo = strip_tags("< < < >hello</b>", "<b>"); echo $foo; Source without strip_tags: "< < < >hello</b>" Source with strip_tags: "hello</b>"I reproduced the problem in PHP 4.1.1, using the same code: $foo = strip_tags("< < <b>hello</b>", "<b>"); echo $foo; // prints "< b>hello" with a hidden "</b>" Tested on Windows XP and Linux 2.4