PHP stripslashes() Function Last Updated : 11 Jul, 2025 Comments Improve Suggest changes Like Article Like Report The stripslashes() function is a built-in function in PHP. This function removes backslashes in a string. Syntax: stripslashes(string) Parameter: This function accepts only one parameter as shown in the above syntax. It is described below: string: This is the only parameter required which specifies the string on which the function will operate. Return Values: This function returns a string with backslashes stripped off. Examples: Input : "Geeks for\ Geeks" Output : Geeks for Geeks Input : "A\ Computer \Science \Portal" Output : A Computer Science Portal Below programs illustrate the stripslashes() function in PHP: Program 1: php <?php //code $str = "Geeks for\ Geeks"; echo stripslashes($str); ?> Output: Geeks for Geeks Program 2: In this program we will see the array implementation of stripslashes() function. stripslashes() is not recursive. In order to apply this function to an array, a recursive function is required. php <?php function stripslashes_arr($value) { $value = is_array($value) ? array_map('stripslashes_arr', $value) : stripslashes($value); return $value; } $array = array("Gee\\ks ", "fo\\r", " \\Geeks"); $array = stripslashes_arr($array); print_r($array); ?> Output: Array ( [0] => Geeks [1] => for [2] => Geeks ) Reference: https://www.php.net/manual/en/function.stripslashes.php Comment R RICHIK BHATTACHARJEE Follow 0 Improve R RICHIK BHATTACHARJEE Follow 0 Improve Article Tags : Misc Web Technologies PHP PHP-string PHP-array +1 More Explore PHP Tutorial 8 min read BasicsPHP Syntax 4 min read PHP Variables 5 min read PHP | Functions 8 min read PHP Loops 4 min read ArrayPHP Arrays 5 min read PHP Associative Arrays 4 min read Multidimensional arrays in PHP 5 min read Sorting Arrays in PHP 4 min read OOPs & InterfacesPHP Classes 2 min read PHP | Constructors and Destructors 5 min read PHP Access Modifiers 4 min read Multiple Inheritance in PHP 4 min read MySQL DatabasePHP | MySQL Database Introduction 4 min read PHP Database connection 2 min read PHP | MySQL ( Creating Database ) 3 min read PHP | MySQL ( Creating Table ) 3 min read PHP AdvancePHP Superglobals 6 min read PHP | Regular Expressions 12 min read PHP Form Handling 4 min read PHP File Handling 4 min read PHP | Uploading File 3 min read PHP Cookies 9 min read PHP | Sessions 7 min read Like