PHP Classes

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

Recommend this page to a friend!
  Info   Documentation   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
Not yet rated by the usersTotal: 98 All time: 9,830 This week: 455Up
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: 249042 in Turkey Turkey
Week rank: 178 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 (3)  
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 (3)  /  src  
File Role Description
  Plain text file is_htmlspecialchars.php Class Class source

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 100%
Total:98
This week:0
All time:9,830
This week:455Up