PHP

PHP Menu

PHP

htmlspecialchars_decode() Function - Definition, Syntax, Parameters, Examples

Definition

The htmlspecialchars_decode() function converts some predefined HTML entities to characters.

Syntax

htmlspecialchars_decode(string, flags)

Parameters

Parameter Description
string Required. Specifies the string to decode.
flags Optional. Specifies how to handle quotes and which document type to use. The available quote styles are:
ENT_COMPAT - Default. Decodes only double quotes
ENT_QUOTES - Decodes double and single quotes
ENT_NOQUOTES - Does not decode any quotes
Additional flags for specifying the used doctype:
ENT_HTML401 - Default. Handle code as HTML 4.01
ENT_HTML5 - Handle code as HTML 5
ENT_XML1 - Handle code as XML 1
ENT_XHTML - Handle code as XHTML

Example

<?php
$str = "This is <b>bold</b> text."; echo htmlspecialchars_decode($str);

Introduction

PHP Basics

PHP Advance

PHP OOP

PHP Functions and Methods