If the current character is b or d , change to a or c respectively and break the loop
if ( $ str [ $ n ] == ' d ' ) { $ str [ $ n ] = ' c ' ; break ; } if ( $ str [ $ n ] == ' b ' ) { $ str [ $ n ] = ' a ' ; break ; }