Stripping characters from a variable

Discussion in 'PHP' started by aaron_nimocks, Oct 13, 2006.

  1. #1
    How can I do this?

    My variable = "/word.html"

    I want to change that to = "word"

    Any idea how to remove the / and .html?
     
    aaron_nimocks, Oct 13, 2006 IP
  2. SoKickIt

    SoKickIt Active Member

    Messages:
    305
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    70
    #2
    $old_variable = "/word.html":
    $new_variable = preg_replace('/\/(.*)\.html/', '\\1', $old_variable);
    PHP:
     
    SoKickIt, Oct 13, 2006 IP