htmlentities

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tco

    htmlentities

    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

    #2
    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_dec ode().
    </quote>

    and you can find more about html_entity_dec ode @
    Convert HTML entities to their corresponding characters



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

    $y = htmlentities($x );
    $z = html_entity_dec ode($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 =--

    Comment

    • steven mestdagh

      #3
      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_dec ode() is the opposite of htmlentities() in that it
      converts all HTML entities to their applicable characters from string.

      Comment

      Working...