Jump To Content

LearnHub




PHP: Stripping Slashes


Stripping Slashes If you need to strip all slashes from user input, such as a username or something along that line, this is how you would do it: PHP Code

Example:

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);
?>


  1. janjeiar saidWed, 29 Jul 2009 00:06:14 -0000 ( Link )

    $username = str_replace(array(“\\”, “/”), ’’, $username);

    Actions
    Vote
    Current Rating
    1
    Rate Up
    Rate Down
    1 Total Vote

    Post Comments

Your Comment
Textile is Enabled (View Reference)