function title_tag () {
// 0. uppercase string
$str = strtoupper ( $_SERVER['REQUEST_URI'] );
// 1. remove trailing and init slash
$str = trim ( $str , "https://wordpress.stackexchange.com/" );
// 2. add search and replace chars;
// two array, with same element size,
// 1. element of search array will be replaced
// with the first element of replace array
$search = array (
'-',
"https://wordpress.stackexchange.com/"
);
$replace = array (
' ',
' - '
);
// 3. replace the chars
$str = str_replace( $search , $replace , $str );
// 4. replace the last occurance of - for ,
// $pos finds the position of the last occurance
// and fortunately, PHP strings can be manipulated
// as arrays, so replace the array element with the
// character
$pos = strrpos ( $str , '-' );
$str{$pos} = ',';
// you're ready
return $str;
}