Hi there.. I'm totally blocked with the next problem.
What I like to do is to read the extension of a remote file..

for example.
URL would be.
http://www.yahoo.com/blabla/file.txt

what I like to have returned is only the 'txt'..
I tried some regex, but all ended in total disaster..

Any ideas?
please help

Regards.. Trackz

    Try:

    $string = "http://www.yahoo.com/blabla/file.txt";
    $len = strlen($string);

    for ($i = $strlen; $i >= 0; $i--) {
    if (substr($string, $i, 1) == ".") {
    $ext = substr($string, $i+1);
    break;
    }
    }

    That should walk backwards through a string looking for the . and then give you everything after it.

      Thanx for the reply, but I don't get this piece of code to work.. Tried to alter some lines, but this didn't help out for the problem.. any other ideas....
      hope so.

      Regards..

        Well what information are you getting from that code? And what strings are you passing it?

        Give me a longer example of what you are doing, or your code and I'll see what I can do.

          Write a Reply...