Hi all, How do i get the end directory name? ie. in the below example i want $file to only echo etc , not /cool/etc
<?php $path = "/cool/etc/file.php"; $file = dirname($path); echo $file; ?>
Cheers, macca
$path = "/cool/etc/file.php"; $file = strrchr(dirname($path), "/"); echo $file;
rtrim the / if you need to.