reguller expression issue

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

reguller expression issue

Post by itsmani1 »

Code: Select all

$str = "abc/jk/child"
           $str1 = "abc/jk/"
           $str2 = "abc/jk/child/end"
           $str3 = "abc/jk/child/images/xyz"
in above strings i want to select the part which comes after last "/" sign. I am not familiar with reguller express, can anyone help me!

Regards.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

No need for [sic] complicated regex, basename() should work just fine...

Code: Select all

[feyd@home]>php -r "$str = 'abc/jk/child'; echo basename($str);"
child
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

thanks,

can i find size of an online page? like i wanted to know size of http://www.maair.net/index.php can i find this, if i can how its done?


Regards.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

thanks much
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

me again......

last thing left.


can i check permissions of some file, and when it was last modified? for example there is a page:
http://www.maair.net/index.php
can i check permissions on this file and can i check when it was modified last time.


Regards.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

not via a remote request unless (some) information is passed via the HTTP headers (last modification time)
User avatar
itsmani1
Forum Regular
Posts: 791
Joined: Mon Sep 29, 2003 2:26 am
Location: Islamabad Pakistan
Contact:

Post by itsmani1 »

feyd wrote:not via a remote request unless (some) information is passed via the HTTP headers (last modification time)

which information is required to pass via http headers
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

It's not information you send, it's header information the server may respond with. It will, at best, only tell you when the file was last modified (it may be false, but there's no way to tell)
Post Reply