Connecting Tech Pros Worldwide Forums | Help | Site Map

htmlentities

tco
Guest
 
Posts: n/a
#1: Jul 17 '05
Hi all,

I'm searching a reverse function for htmlentities.... i couldn't find
anything in the manual and over forums :-/
does anyone have an idea ?

many thanks in advance,
--
tco



Pedro Graca
Guest
 
Posts: n/a
#2: Jul 17 '05

re: htmlentities


tco wrote:[color=blue]
> I'm searching a reverse function for htmlentities.... i couldn't find
> anything in the manual and over forums :-/
> does anyone have an idea ?[/color]

Very well hidden after the charsets table, you can find

<quote src="http://www.php.net/htmlentities">
If you're wanting to decode instead (the reverse) you can use
html_entity_decode().
</quote>

and you can find more about html_entity_decode @
http://www.php.net/html_entity_decode


#v+
<?php
$x = 'test <html parm="val"/> test';

$y = htmlentities($x);
$z = html_entity_decode($y);

echo "x=$x\ny=$y\nz=$z\n";
?>
#v-

The output is (I run PHP in command-line mode):
x=test <html parm="val"/> test
y=test &lt;html parm=&quot;val&quot;/&gt; test
z=test <html parm="val"/> test
-
--= my mail box only accepts =--
--= Content-Type: text/plain =--
--= Size below 10001 bytes =--
steven mestdagh
Guest
 
Posts: n/a
#3: Jul 17 '05

re: htmlentities


tco <tco@nospam.org> wrote:[color=blue]
> Hi all,
>
> I'm searching a reverse function for htmlentities.... i couldn't find
> anything in the manual and over forums :-/[/color]

from the manual:

html_entity_decode() is the opposite of htmlentities() in that it
converts all HTML entities to their applicable characters from string.
Closed Thread