PHP FILTER_SANITIZE_MAGIC_QUOTES

What is FILTER_SANITIZE_MAGIC_QUOTES in PHP?

Explanation

PHP FILTER_SANITIZE_MAGIC_QUOTES filter is used to add backslash in front of each predefined characters.
Such as,
  single quote (')
  double quote (")
  backslash ()
  NULL
Name: "magic_quotes"
ID-number: 521

Example :


<?php
$va1="hscripts.com is a hiox's website";
echo filter_var($va1, FILTER_SANITIZE_MAGIC_QUOTES);
?>

Result :

hscripts.com is a hiox's website

In the above example, the backslash() is added before the predefined character single quotes(') in the given string.

PHP Topics


Ask Questions

Ask Question