I am using a function to display the URL on title tag, I coded this function which works properly but I would like to customize it more further.
function title_tag()
{
$a = $_SERVER['REQUEST_URI'];
$b = strtoupper($a);
$c = str_replace('-', ' ', $b);
$d = str_replace('/', ' - ', $c);
$e = substr($d, 2);
return $e;
}
This function will display the url on title after inserting this code in title tag.
<title><?php echo title_tag(); ?></title>
The current code is displaying the title in this format, my title of website:
STANFORD UNIVERSITY - MBA IN CALIFORNIA - MBA -
But I want to display it in this format, just the change in punctuations
STANFORD UNIVERSITY - MBA IN CALIFORNIA, MBA -
Just a comma as separator in between How can I have this?