• PHP Video Tutorials

PHP - Function htmlentities



Syntax

string htmlentities ( string $string [, int $flags = ENT_COMPAT | ENT_HTML401 
   [, string $encoding = ini_get("default_charset") [, bool $double_encode = true ]]] )

Definition and Usage

It is used to convert all applicable characters to Html entities

Return Values

It returns the encoded string.

Parameters

Sr.No Parameters & Description
1

string

It contains the information about input string

2

flags

It contains the information about flags

3

encoding

It is an optional argument defining the encoding used when converting characters.

Example

Try out the following example

<?php
   $str = "PHP Function htmlentities";
   
   echo htmlentities($str);
   echo htmlentities($str, ENT_QUOTES);
?>

This will produce following result − −

PHP Function htmlentitiesPHP Function htmlentities
php_function_reference.htm
Advertisements