Interchange all occurrences of a character and its predecessor
You want to do a string replacement operation, so use preg_replace().  The key is to use backreferences in the replacement.  Also, since you seem to be interested in processing Unicode, be sure to use the u flag for the regex.

If, as you say, 'b' is just an example, then you can make it a default parameter.

function punjabi_alternate($string, $char='b') {
    return preg_replace("/(.)($char)/u", '\2\1', $string);
}