Helpful Information
Home
Categories
Contact us
Category: PHP
Getting directory name
How can I get the name of the current directory a user is viewing?
$url = explode("/",$PHP_SELF);
$filename = $url[sizeof($url)-1];
$dir = $url[sizeof($url)-2];
Doesn't matter, found this
or ...
<?
echo dirname ($_SERVER[PHP_SELF]);
?>
:)
Thanks :) Is your way less stress on the server too?
without groping through the Zend source I am unsure how dirname() is handled internally but I would assume it would have to be more efficient ??
privacy (GDPR)