Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1

    Default help in getting the string after the slash in php?


    mga master naa koy question gamay

    help in getting the string after the slash in php?

    ex.

    folder/filie.txt

    i want to get the string "file.txt"

    $vhar=file.txt;

    thank you

  2. #2

  3. #3
    Quote Originally Posted by pulchra View Post
    mga master naa koy question gamay

    help in getting the string after the slash in php?

    ex.

    folder/filie.txt

    i want to get the string "file.txt"

    $vhar=file.txt;

    thank you
    $vpath = 'folder/filie.txt';
    $vhar = trim(strstr($vpath,'/'), '/');

    or

    $vhar = substr($vpath, strpos($vpath, '/'));

    or

    $vpath_arr = explode('/', $vpath);
    $vhar = $vpath_arr[1];

  4. #4
    e explode na oi..
    $path = "folder/filie.txt";
    $string = explode("/",$path);
    array ang result ane.. e echo ang $string[1];

  5. #5

  6. #6
    @darkhero: necropost, pero nice info.

  7. #7
    $filepath="folders/file.txt";
    $tmp=explode('/',$filepath);

    $fname= $tmp[count($tmp)-1];


    I hope this helps

  8. #8
    Quote Originally Posted by doomsweek View Post
    @darkhero: necropost, pero nice info.
    yep. ni-post ra ko kay wa man jud naka-post about sa basename, basin makatabang pa diay ug lain. kung regular expressions gamiton mao ni akong ika-share...

    PHP Code:
        $path "/home/darkhero/file.txt";
        
    $file = (preg_match("/\/?([^\/]+)$/"$path$file)) ? $file[1] : false;
        echo 
    $file
    about sa uban posts nga explode ang gigamit, akong ika-suggest kay same sa post ni sanggano_boy. i-explode, then count, then kuhaon ang pinaka-last nga item sa array.

    EDIT: another reason nga ni-post ko kay naay flaws ang previous posts before sa akoa. kung way slash, mo-fail ang post ni bishop_; kung more than one slash, mo-fail ang post ni romano2717.

    EDIT: dili na mo-matter kung nag-necromancy ko bro as long as naa koy natabangan... dili ra kay nang-hambog nga kabalo ko.

  9. #9
    wa man ko ni ingon na nang-hambog ka

  10. #10
    Quote Originally Posted by doomsweek View Post
    wa man ko ni ingon na nang-hambog ka
    yeah... niingon diay ko nga ni-sulti ka ana? sobraan man pud ka ka-brayt bro?

    EDIT: cge ra ka pamantay ug sayop bro pero ang actual natabang nimo kay NIL. unsay tawag ana? himantayon?

  11.    Advertisement

Page 1 of 2 12 LastLast

Similar Threads

 
  1. What's happening in Manila after the Typhoon?
    By Phazuka in forum General Discussions
    Replies: 2
    Last Post: 02-13-2009, 01:24 PM
  2. The day after the night before
    By hmmn in forum Fitness & Health
    Replies: 0
    Last Post: 01-01-2009, 09:20 AM
  3. Help me in getting out the virus
    By mondray in forum Software & Games (Old)
    Replies: 8
    Last Post: 09-21-2007, 10:38 AM
  4. Replies: 6
    Last Post: 11-07-2006, 10:21 PM
  5. Replies: 32
    Last Post: 02-24-2006, 10:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top