4 ms·
Perl does this, too. And is it really that unexpected? How many possible things could 'z'+1 return? The only possibilities that make sense to me are "{", "aa",
by photon_off 16y ago
Perl does this, too. And is it really that unexpected? How many possible things could 'z'+1 return? The only possibilities that make sense to me are "{", "aa", or an error. I like PHP because it's flexible, and this often makes life easier. If you're really going to try to use strings as integers, then you deserve what's coming to you. If you're going to use this behavior as a feature, then you've just saved yourself a chunk of time.
- pbhjpbhj 16y ago>How many possible things could 'z'+1 return? That are less than or equal to z?
- loewenskind 16y agoMore sensible would be to not overload the ++ or +1 operator to do this but provide a different function. Then the capability is there but something unexpected doesn't happen in the presence of type errors.
- jeffffff 16y agoi would certainly expect it to go through the charset in order instead of jumping back to a, but if you think of a string as a base 256 (or 26 in this case) number then it makes sense