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.
There are the following the list of The predefined characters are:
- single quote (‘)
- double quote (“)
- backslash (\)
The syntax of the very helpful addslashes method is below:
|string_name||The specified string.||Required||String|
Return String values: The great escaped string Like as a python double slash.
PHP addslashes() Function
simple defination included a backslash in front of available in each double quote (“):
<!DOCTYPE html> <html> <body> <?php $results = addslashes('What does "Papega" mean?'); echo($results); ?> </body> </html>
What does \"Papega\" mean?
Input : $string = "Pakainfo's" Output : Pakainfo\'s Input : $string='Papega whatsappweb "xname"' Output : Papega whatsappweb \"xname\"
Example 1 with demo
<?php // PHP Example to demonstrate the // Input String $str = addslashes('Papega whatsappweb "xname"'); // prints the escaped string echo($str); ?>
Papega whatsappweb \"xname\"
Example 2 with demo
<?php // PHP Example to demonstrate the // Input String $str = addslashes("Pakainfo's"); // prints the escaped string echo($str); ?>
Also you can learn more Reference:http://php.net/manual/en/function.addslashes.php
I hope you get an idea about PHP Manual: addslashes.
I would like to have feedback on my infinityknow.com 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.