title: Find first character that is different between two strings
body: <p>Given two equal-length strings, is there an elegant way to get the offset of the first different character?</p>
  
  <p>The obvious solution would be:</p>
  
  <pre><code>for ($offset = 0; $offset &lt; $length; ++$offset) {
      if ($str1[$offset] !== $str2[$offset]) {
          return $offset;
      }
  }
  </code></pre>
  
  <p>But that doesn't look quite right, for such a simple task.</p>