$totalSegsCount = count(Request::segments()); $title =[]; for($i=1; $i<=$totalSegsCount; $i++) { $title[]=ucwords(str_replace('-',' ', Request::segment($i))); } $title=implode(' | ',$title); ?>