Re: [PHP] SCRIPT_NAME

2005-10-21 Thread Minuk Choi
... what, the off by one error? Hey, I was just providing suggestion off the top of my head. :-P -Minuk Robert Cummings wrote: On Thu, 2005-10-20 at 23:27, Minuk Choi wrote: Off the top of my head... $filename = $_SERVER['PHP_SELF']; $strippedFilename = substr($filename,

Re: [PHP] SCRIPT_NAME

2005-10-21 Thread Robert Cummings
On Fri, 2005-10-21 at 19:58, Minuk Choi wrote: ... what, the off by one error? Hey, I was just providing suggestion off the top of my head. :-P Oh I know, I was just pointing out that it won't work :) Doesn't work because it only strips off the first path segment (assuming no off by one error

Re: [PHP] SCRIPT_NAME

2005-10-21 Thread Jasper Bryant-Greene
On Fri, 2005-10-21 at 21:01 -0400, Robert Cummings wrote: Oh I know, I was just pointing out that it won't work :) Doesn't work because it only strips off the first path segment (assuming no off by one error also ;). For instance: /a/b/c/d/foo.php becomes: a/b/c/d/foo.php

Re: [PHP] SCRIPT_NAME

2005-10-21 Thread Robert Cummings
On Sat, 2005-10-22 at 10:02, Jasper Bryant-Greene wrote: On Fri, 2005-10-21 at 21:01 -0400, Robert Cummings wrote: Oh I know, I was just pointing out that it won't work :) Doesn't work because it only strips off the first path segment (assuming no off by one error also ;). For instance:

[PHP] SCRIPT_NAME

2005-10-20 Thread John Taylor-Johnston
SCRIPT_NAME and PHP_SELF always include leading url information and slashes. Is there a function I can use to skin either down to the filename? No slashes or leading url. John -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] SCRIPT_NAME

2005-10-20 Thread Jasper Bryant-Greene
On Thu, 2005-10-20 at 22:22 -0400, John Taylor-Johnston wrote: SCRIPT_NAME and PHP_SELF always include leading url information and slashes. Is there a function I can use to skin either down to the filename? No slashes or leading url. http://php.net/basename for filesystem paths

Re: [PHP] SCRIPT_NAME

2005-10-20 Thread Robert Cummings
On Thu, 2005-10-20 at 22:22, John Taylor-Johnston wrote: SCRIPT_NAME and PHP_SELF always include leading url information and slashes. Is there a function I can use to skin either down to the filename? No slashes or leading url. echo ereg_replace( '^.*/', '', $_SERVER['SCRIPT_NAME'] ) ereg

Re: [PHP] SCRIPT_NAME

2005-10-20 Thread Minuk Choi
Off the top of my head... $filename = $_SERVER['PHP_SELF']; $strippedFilename = substr($filename, strrpos($filename, '/')); references : http://us3.php.net/substr http://us3.php.net/manual/en/function.strrpos.php -Minuk John Taylor-Johnston wrote: SCRIPT_NAME and PHP_SELF always include

Re: [PHP] SCRIPT_NAME

2005-10-20 Thread Robert Cummings
On Thu, 2005-10-20 at 23:27, Minuk Choi wrote: Off the top of my head... $filename = $_SERVER['PHP_SELF']; $strippedFilename = substr($filename, strrpos($filename, '/')); Won't work, I'll leave the reason as an exercise :B Cheers, Rob. --