PHP FILTER_SANITIZE_MAGIC_QUOTESFilter
Complete PHP Filter Reference
Definition and Usage
The FILTER_SANITIZE_MAGIC_QUOTES filter executes theaddslashes()function on strings.
This filter adds backslashes before predefined strings.
Predefinedcharactersare:
- Single quote (')
- Double quote (\")
- Backslash (\)
- NULL
FILTER_SANITIZE_MAGIC_QUOTES Information:
- Name: "magic_quotes"
- ID-number: 521
Example
$var="Peter's here!";
var_dump(filter_var($var, FILTER_SANITIZE_MAGIC_QUOTES));
The output of the code is shown below:
string(14) "Peter\'s here!"
Complete PHP Filter Reference Other Extensions