Candrias77
09-18-2003, 07:34 AM
One one site I am using this script to identify the name of the file that executes that script (minus the extension)
preg_replace('/(.+)(\..+?)$/', '\\1', basename($_SERVER['PHP_SELF']))
On a new site I want to identify the name of the folder containing the file executs this script, ie. if this code was run from www.mysite.com/folder/file.php at the moment it will return "file" but I would like it to return "folder".
I am not sure where I got the above script but I am absolutely dumbfounded when it comes to regular expressions! I would really appreciate any help I can get on making this folder identifying script.
Thanks heaps.
preg_replace('/(.+)(\..+?)$/', '\\1', basename($_SERVER['PHP_SELF']))
On a new site I want to identify the name of the folder containing the file executs this script, ie. if this code was run from www.mysite.com/folder/file.php at the moment it will return "file" but I would like it to return "folder".
I am not sure where I got the above script but I am absolutely dumbfounded when it comes to regular expressions! I would really appreciate any help I can get on making this folder identifying script.
Thanks heaps.