PHP addslashes Function with Examples


The Core PHP addslashes method is used to some extra add slashes to explicit characters in a Data string. Those all the string characters are available ignore quotes on single quote (‘), double quote (“) or slash, as well as backslash symbol, the NULL empty character. This method is helpful when I try to added some data strings into a any type of the database Like as a MySQL. also you can learn my prev All about PHP Function. like as stripslashes, escape forward slash, escape special characters, php addslashes sql injection or many more.

List of all Google Adsense, VueJS, AngularJS, PHP, Laravel Examples.

There are the following the list of The predefined characters are:

  • single quote (‘)
  • double quote (“)
  • backslash (\)
  • NULL

The syntax of the very helpful addslashes method is below:

addslahes ('string')


Name Description Required /
string_name The specified string. Required String

Return String values: The great escaped string Like as a python double slash.

escaped,python double slash,backslash symbol,ignore quotes,single quote
PHP addslashes Function with Examples

PHP addslashes() Function

simple defination included a backslash in front of available in each double quote (“):

<!DOCTYPE html>

$results = addslashes('What does "Papega" mean?');



What does \"Papega\" mean?

php addslashes not working,addslashes and stripslashes in php,php addslashes sql injection,addcslashes in php,php escape special characters,php escape forward slash,php escape single quote,php escape characters,
PHP addslashe Function


Input : $string = "Pakainfo's"
Output : Pakainfo\'s

Input : $string='Papega whatsappweb "xname"'
Output : Papega whatsappweb \"xname\"

Example 1 with demo

// PHP Example to demonstrate the 

// Input String 
$str = addslashes('Papega whatsappweb "xname"'); 

// prints the escaped string 


Papega whatsappweb \"xname\"

Example 2 with demo

// PHP Example to demonstrate the  

// Input String 
$str = addslashes("Pakainfo's"); 

// prints the escaped string 



Also you can learn more Reference:

Web Programming Tutorials Example with Demo

Read :


You can also read about AngularJS, ASP.NET, VueJs, PHP.

I hope you get an idea about PHP Manual: addslashes.
I would like to have feedback on my blog.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.

Related FAQ

Here are some more FAQ related to this Article:

  1.   Like Dislike system with PHP and MySQL
  2.   wheredate in laravel | Eloquent date filtering : whereDate()
  3.   how to check install laravel version?
  4.   How to create a Login page with PHP and MySQL
  5.   ERROR 1118 (42000) Row size too large
  6.   PHP GET File Contents Data Scraping Example
  7.   PHP MySQL Dynamic SQL Insert Query
  8.   Top 10 Common PHP Job Interview Questions and Answers
  9.   laravel cache clear
  10.   php - how to get ip address in codeigniter

Leave a Reply

Your email address will not be published. Required fields are marked *