- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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_STRING constant in PHP
The FILTER_SANITIZE_STRING constant deletes tags and encodes special characters from a string.
Flags
FILTER_FLAG_NO_ENCODE_QUOTES − Do not encode quotes
FILTER_FLAG_STRIP_LOW − Removes characters with ASCII value less than 32
FILTER_FLAG_STRIP_HIGH − Removes characters with ASCII value greater than 127
FILTER_FLAG_ENCODE_LOW − Encodes characters with ASCII value less than 32
FILTER_FLAG_ENCODE_HIGH − Encodes characters with ASCII value greater than 127
FILTER_FLAG_ENCODE_AMP − Encodes the "&" character to &
Return
The FILTER_SANITIZE_STRING constant does not return anything.
Example
<?php $var = "<p>£Demo! ££</p>"; $res = filter_var($var, FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH); echo $res; ?>
Output
The following is the output.
Demo!
Advertisements