I use a glob function to list a folder items, the code below give me text like this "flash/movies", but I would like to trim the url to display only "movies". Can you help me what should I do ?
$dir = glob("flash/*");
usort($dir, function($a, $b){
return filemtime($a) < filemtime($b);
});
foreach ($dir as $plk) {
echo '<h4>' . $plk . '</h4>';
}
You can use the basename() function. This returns the "trailing path component", which is the directory name that you are looking for.
For example:
echo '<h4>' . basename($plk) . '</h4>';