Easy Tutorial
❮ Php Intlchar Func Filesystem Glob ❯

PHP FILTER_SANITIZE_MAGIC_QUOTES Filter



Definition and Usage

The FILTER_SANITIZE_MAGIC_QUOTES filter applies the addslashes() function to a string.

This filter adds backslashes before predefined characters in a string.

Predefined characters:


Example

<?php
$var = "Peter's here!";

var_dump(filter_var($var, FILTER_SANITIZE_MAGIC_QUOTES));
?>

The output of the code is as follows:

string(14) "Peter\'s here!"
❮ Php Intlchar Func Filesystem Glob ❯