Javatpoint Logo
Javatpoint Logo

PHP addslashes() Function

PHP addslashes() function is used to return a quote string with slashes. It works with some characters:

  • Single quote (')
  • Double quote(")
  • Blackslash(|)
  • NUL (the NUL byte)


Parameter Description Required/Optional
string String to be escaped Required

Example 1


Your string is :What does "WHO" mean?
By using addslashes() function the result isWhat does \"WHO\" mean?

Example 2


Who's the father of PHP? This is not safe in a database query.
Who\'s the father of PHP? This is safe in a database query.

Example 3


Wow' PHP?

A use case of addslashes() is escaping the abovementioned characters in a string that is to be evaluated by PHP:

Example 4


Is The Father of PHP\'Rasmus? 

Next TopicPHP String

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA