PHP addslashes Function

What is addslashes() Function?

Explanation

The addslashes() function is used to return a string with slashes in front of the predefined characters like (',", , NULL).

Syntax:


addslashes(string)

In the above syntax the slashes are added before the "characters" specified in the "(string)" .

Example :


<?php
$s = "hi how'ss life.";
echo addslashes($s)."<br/>";
?>
Result :

hi how'ss life.

In the above example the back slashes are added before the character "'".

PHP Topics


Ask Questions

Ask Question