Simple question: Stripping off part of a string

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • lecichy

    Simple question: Stripping off part of a string

    Hello

    Its not that I want somebody to do work for me, I really read all about
    preg_replace and other pregs and strs but cant actually do this one:
    A specific example of code would be very appreciated.

    $path = "/var/www/help/index.php";

    the path can differ, there are more or less dirs but there always is
    "/var/www" part and I want to strip it off and get whatever comes after
    that.
    I really cant understand these preg_replace parameters like
    ("/(<\/?)(\w+)([^>]*>)/e", So could anyone help me in the above specific
    example ?






  • Steven Musumeche

    #2
    Re: Simple question: Stripping off part of a string

    str_replace("/var/www", "", $path)

    -Steve


    "lecichy" <counter@vline. pl> wrote in message
    news:bmru2s$psi $1@nemesis.news .tpi.pl...[color=blue]
    > Hello
    >
    > Its not that I want somebody to do work for me, I really read all about
    > preg_replace and other pregs and strs but cant actually do this one:
    > A specific example of code would be very appreciated.
    >
    > $path = "/var/www/help/index.php";
    >
    > the path can differ, there are more or less dirs but there always is
    > "/var/www" part and I want to strip it off and get whatever comes after
    > that.
    > I really cant understand these preg_replace parameters like
    > ("/(<\/?)(\w+)([^>]*>)/e", So could anyone help me in the above specific
    > example ?
    >
    >
    >
    >
    >
    >[/color]


    Comment

    Working...