Forum Moderators: coopster
ereg("/.*?/?([A-Za-z_]*)\.php/", $_SERVER['PHP_SELF'], $tags); echo $tags[1]
I'm pretty sure the problem is in the regular expression string but i just can't seem to find what the problem may be. 'PHP_SELF' is relative to the server so I don't have to worry about looking past that in my regular expression string but sometimes there is no 'subvar' so I would want to just return 'var1.html' Any help would be great and thanks in advance.
PATHINFO_FILENAMEconstant otherwise you'll have to do the extra work as you have done here to pull it out of the
PATHINFO_BASENAMEconstant (or use basename [php.net]).
print pathinfo($_SERVER['REQUEST_URI'], PATHINFO_BASENAME);
// Or, with PHP >= 5.2.0
print pathinfo($_SERVER['REQUEST_URI'], PATHINFO_FILENAME);