SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: extracting some useful data from variable

  1. #1
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    extracting some useful data from variable

    Hello

    I have a variable like this

    $test="/usr/local/software/test";

    and I want get only /usr/local/software from the variable above.
    Which is the fast way to get it (possibly without using explode_array) ?

    it should work also in other situations for example


    $test="/usr/local/software/my/world";

    should return "/usr/local/software/my"


    Any help please ?

    Thank you
    trcris ::> http://www.trcris.com

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    dirname()

  3. #3
    SitePoint Addict
    Join Date
    Feb 2004
    Location
    Rome
    Posts
    286
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks (works perfectly)
    trcris ::> http://www.trcris.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •