Escaping backslashes...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • The1corrupted
    New Member
    • Feb 2007
    • 134

    Escaping backslashes...

    Okay, this is somewhat annoying but I need to escape backslashes to make something look nice.

    [PHP]
    <?php
    if ($mesgread[0]=="/" AND $user!=$otherus er) {
    $action=explode (" ", $msg, 2);
    $_SESSION['chat']=$_SESSION['chat'].$action[1]."<br>";
    echo $META
    }
    [/PHP]
    This all works fin and dandy but when I go to echo the $_SESSION['chat'], backslashes appear before quotes.. Say $action[1]="This said "STUFF" and disappeared" it would end up echoing "This said \"STUFF\" and disappeared".
  • ronverdonk
    Recognized Expert Specialist
    • Jul 2006
    • 4259

    #2
    Use the stripslashes command in php. See the standard php documentation about the use of escape characters.

    string stripslashes ( string $str )

    Returns a string with backslashes stripped off. (\' becomes ' and so on.) Double backslashes (\\) are made into a single backslash (\).
    Ronald :cool:

    Comment

    Working...