getting character from a name
Posted: Wed Mar 16, 2011 2:05 pm
so let's say I have a url that ends with stage3.php, I need to figure out a way to get just that 3 from the url. The other "problem" I guess I should say is, if the url ends in stage15.php then I need it to return the 15, not just the 1 or the 5. Any help would be greately appreciated. I am honestly not sure where to even start, since I am not sure how to retrieve it from the url without the $_GET command, and since it's not being passed as a variable I am not sure how to grab it. It could be something like sitename.com/stage15.php. Thank you for your help in advance and I hope I am making sense.
EDIT: So I was able to get the current page name using
now I just need to figure out how to get the numbers right before the period
EDIT: So I was able to get the current page name using
Code: Select all
function curpage() {
return substr($_SERVER["SCRIPT_NAME"], strrpos($_SERVER["SCRIPT_NAME"], "/") +1);
}