function getTitleFromFilenameWithoutExt(&$filename) { $folder_array = explode('/', $filename); //Explode the filename (folder and file name) $count_array = count($folder_array); //Count this array $last_array_value = $count_array - 1; //The last array value is (Count array - 1) return PhocaGalleryHelper::removeExtension($folder_array[$last_array_value]); }