Description
string
htmlentities
( string string [, int quote_style [, string charset]])
This
function
is
identical
to
htmlspecialchars(
)
in
all
ways
,
except
that
all
characters
which
have
HTML
character
entity
equivalents
are
translated
into
these
entities
.
Like
htmlspecialchars(
)
,
it
takes
an
optional
second
argument
which
indicates
what
should
be
done
with
single
and
double
quotes
.
ENT_COMPAT
ENT_COMPAT
(
the
default
)
will
only
convert
double-quotes
and
leave
single-quotes
alone
.
ENT_QUOTES
will
convert
both
double
and
single
quotes
,
and
ENT_NOQUOTES
will
leave
both
double
and
single
quotes
unconverted
.
At
present
,
the
ISO-8859-1
character
set
is
used
as
default
.
Support
for
the
optional
second
argument
was
added
in
PHP
3.0.17
and
PHP
4.0.3
.
There
is
no
reverse
of
this
function
.
However
,
you
can
create
one
on
your
own
.
Here
is
an
example
of
how
to
do
this
.
דוגמה
1
.
Reverse
of
htmlentities(
)
?php
function
unhtmlentities
(
$string
)
{
$trans_tbl
=
get_html_translation_table
(HTML_ENTITIES)
;
$trans_tbl
=
array_flip
($trans_tbl)
;
return
strtr
($string
,
$trans_tbl)
;
}
?
|
|
See
also
htmlspecialchars(
)
and
nl2br(
)
.