
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
FILTER_SANITIZE_ENCODED constant in PHP
The FILTER_SANITIZE_ENCODED constant encodes special characters.
Flags and Options
FILTER_FLAG_STRIP_LOW − Remove characters with ASCII value less than 32
FILTER_FLAG_STRIP_HIGH − Remove characters with ASCII value greater than 127
FILTER_FLAG_ENCODE_LOW − Encode characters with ASCII value less than 32
FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value greater than 127
Return
The FILTER_SANITIZE_ENCODED constant does not return anything.
Example
The following is an example that use FILTER_FLAG_ENCODE_HIGH flag to encode characters with ASCII value > 127
Example
<?php $url="wwwÅ.exampleÅ.com"; $url = filter_var($url, FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH); echo $url; ?>
Output
The following is the output.
www.example.com
Let us see another example.
Example
<?php $url="example.com££"; $url = filter_var($url, FILTER_SANITIZE_ENCODED, FILTER_FLAG_STRIP_HIGH); echo $url; ?>
Output
Here is the output.
example.com
Advertisements