Let’s say you have a bool, $is_match then whenever two chars of the string don’t match you write false to it.
It takes slightly longer to write false than do nothing. You’re still leaking the total number of matching characters.
I think speculative execution on the CPU would amplify this effect. For example:
aaaaaaaaa != ccccccccc will be much faster than ababababa != aaaaaaaaa because in the first example the cpu will correctly guess and speculatively execute that the two characters are different. They were different last time. They’ll probably be different again.