• home
  • forum
  • my
  • kt
  • download
  • Testing htmlentities() PHP Function

    Author: 2008-08-27 08:25:17 From:

    Most of you probably know that there are 3 basic HTML special characters reserved for HTML tags and entities: (<), (>) and (&).

    But there are 2 more characters reserved for quoting tag attributes: (") and (').

    If you don't protect those characters, your Web page will not work. Try the following HTML code, and see what happens:

    Question: is it true that 23:59 < 00:00?<br>
    Answer: <input value='it's true.'>
    

    How to use and test htmlentities() PHP function?

    htmlentities(string) is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are converted into these entities. For example

    • '&' (ampersand) becomes '&amp;'
    • '"' (double quote) becomes '&quot;'
    • ''' (single quote) becomes '&#039;' only when ENT_QUOTES is set. Not a default behavior.
    • '<' (less than) becomes '&lt;'
    • '>' (greater than) becomes '&gt;'

    To help you learn and test htmlentities() function, FYIcenter.com has designed this online testing page. All you need to do is to enter the testing string in the form below and click the Start button. The converted string will be presented in the result area.

    String:

    discuss this topic to forum

    relation tutorial

    No relevant information

    Category

      Ad Management (4)
      Calendars (3)
      Chat Systems (7)
      Content Management (6)
      Cookies and Sessions (8)
      Counters (8)
      Database Related (8)
      Date and Time (9)
      Development (16)
      Discussion Boards (8)
      E Commerce (8)
      Email Systems (13)
      Error Handling (7)
      File Manipulation (24)
      Flash and PHP (6)
      Form Processing (19)
      Guestbooks (12)
      Image Manipulation (21)
      Installing PHP (7)
      Introduction to PHP (23)
      Link Indexing (8)
      Mailing List Management (9)
      Miscellaneous (53)
      Networking (8)
      News Publishing (9)
      OOP (24)
      PEAR (6)
      PHP vs Other Languages (2)
      Polls and Voting (6)
      Postcards (1)
      Randomizing (14)
      Redirection (11)
      Searching (9)
      Security (29)
      Site Navigation (16)
      User Authentication (14)
      WAP and WML (7)
      Web Fetching (8)
      Web Traffic Analysis (15)
      XML and PHP (16)

    New

    Hot