// phpShack / PHP & MySQL Tutorials / Stripping Slashes
 

Navigation





 

Stripping Slashes

If you need to strip all slashes from user input, such as a username or something like that, this is how you would do it:


PHP Code Example:
<?
/* $username is the input from the user with the slashes in it 
   like u//ser\n/a/m\e woud become username after this */

// Removes the slashes from the input
$username str_replace(array("\", "/"), '', $username); 
?>