PHP addslashes() Function

The addslashes() function is used to add backslashes in the sentances from predefined character .

Demo :



Type Text    

Example :

Type sentance at textarea like this : 'Cascading Style Sheets (CSS) are the saviors of responsible web design'..

If you need to add slashes for a single quote (') or double quote (") following code useful to you.


<?php
  $str = "'Cascading Style Sheets (CSS) are the saviors of responsible web design'";
  $result = addslashes($str);
  echo $result;
?>

In the above code is used to slashes for a single quote (') .The sentence will pass to the addslashes() function.Finally output will display like "\'Cascading Style Sheets (CSS) are the saviors of responsible web design\'".In the addslashes() function have one parameters that name is string str.

Free Download Script :

If you need addslashes() function demo code download from following link.

Download




Content