PHP Classes

IS PHP HTMLSpecialChars: Check if a HTML string contains special characters

Recommend this page to a friend!
  Info   View files Documentation   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 98 All time: 9,826 This week: 455Up
Version License PHP version Categories
is_htmlspecialchars 1.0GNU General Publi...5HTML, PHP 5, Searching


This is a simple class that can check if an HTML string contains special characters.

It takes a string with HTML tags and searches it to find characters like < , > and & .

The class returns true if any HTML special characters are found.

Innovation Award
PHP Programming Innovation award nominee
December 2021
Number 7
HTML uses special characters like <, > and & to define tags inserted in the document text to mark the documents in a specific way.

This class returns whether a given text string contains HTML special characters. So you can it to determine if a given text can be HTML.

Manuel Lemos
Picture of Ali YILMAZ
  Performance   Level  
Name: Ali YILMAZ <contact>
Classes: 16 packages by
Country: Turkey Turkey
Age: ???
All time rank: 249142 in Turkey Turkey
Week rank: 271 Up7 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 8x


What is is_htmlspecialchars ?

This package serves to check whether the data shared with it contains HTML special characters. The data must be specified in string type. Returns true if the HTML contains special characters, otherwise false.


$code = 'merhaba &lt;?=$this-&gt;timestamp;?&gt;';

Out-of-class use:


    echo 'HTML contains special characters.';
} else {
    echo 'HTML does not contain special characters';

When using it in the class:


    echo 'HTML contains special characters.';
} else {
    echo 'HTML does not contain special characters';


HTML contains special characters.


This package has no dependencies.


Instructions and files in this directory are shared under the GPL3 license.

  Files folder image Files  
File Role Description
Files folder imagesrc (1 file)
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  src  
File Role Description
  Plain text file is_htmlspecialchars.php Class Class source

 Version Control Unique User Downloads Download Rankings  
This week:0
All time:9,826
This week:455Up