Convert some characters to HTML entities using the Western European character-set in PHP

Description

The following code shows how to convert some characters to HTML entities using the Western European character-set.

Example


  /*from   w w  w  . ja  va2s  .c  o  m*/
<?php
   $str = "this is a 'quotation'.";
   echo htmlentities($str, ENT_QUOTES, "ISO-8859-1"); 
   // Will only convert double quotes (not single quotes), and uses the character-set Western European
?>

The code above generates the following result.





















Home »
  PHP Tutorial »
    Data Types »




Array
Array Associative
Array Util
ArrayObject
Data Types
Date
Date Format
DateTime
Number
String
String Escape
String Filter
String HTML
String Type
Timezone