Another odd thing about it is that $replacex(1234,234,u,123,z,12,x) also returns z4. So it isn't reading the matches backwards and it isn't checking "1" then "12" then "123" or whatever
It's like I said, it doesn't try to match each parameter seperatly, it 'browses' the string and then try to match the parameter, "123" will always match first because it appears first in the string, the position of that parameter isn't important