Example 1 — Undo addslashes()
Add a backslash, then remove it.
<?php
$safe = addslashes("It's fine");
echo $safe, PHP_EOL;
echo stripslashes($safe), PHP_EOL; How It Works
- Call addslashes(). It puts a backslash before the quote.
- Print the escaped text. You can see
\'. - Call stripslashes(). The backslash is removed.
- Get the original text. The apostrophe is back to normal.

