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 This week: 1All time: 9,810 This week: 571Up
Version License PHP version Categories
is_htmlspecialchars 1.0GNU General Publi...5HTML, PHP 5, Searching
Description 

Author

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: 250042 in Turkey Turkey
Week rank: 50 Up2 in Turkey Turkey Up
Innovation award
Innovation award
Nominee: 8x

Documentation

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.

data:

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

Out-of-class use:

code:

require_once('Mind.php');
if($m::aliyilmaz('is_htmlspecialchars')->is_htmlspecialchars($code)){
    echo 'HTML contains special characters.';
} else {
    echo 'HTML does not contain special characters';
}

When using it in the class:

code:

if(self::aliyilmaz('is_htmlspecialchars')->is_htmlspecialchars($code)){
    echo 'HTML contains special characters.';
} else {
    echo 'HTML does not contain special characters';
}

output:

HTML contains special characters.

Dependencies

This package has no dependencies.

License

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 README.md 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  
 100%
Total:98
This week:1
All time:9,810
This week:571Up