title: hash_djb2 PHP result is wrong?
body: <p>C++</p>
  
  <pre><code>unsigned int hash_djb2(char *str, unsigned int str_size)
  {
      unsigned int hash = 5381;
  
      for(unsigned int c = 0; c &lt; str_size; c++)
          hash = ((hash &lt;&lt; 5) + hash) + str[c];
  
      return (hash &amp; 0xFFFFFFFF);
  }
  
  int main()
  {
      string term = "one piece";
      char* data = const_cast&lt;char*&gt;(term.c_str());
      printf("%u", hash_djb2(data, term.size()));//2850035213
  }
  </code></pre>
  
  <p>PHP</p>
  
  <pre><code>&lt;?php
      function hash_djb2($str)
      {
          $hash = 5381;
          $length = strlen($str);
          for($i = 0; $i &lt; $length; $i++) {
              $hash = ( ($hash &lt;&lt; 5) + $hash ) + $str[$i];
          }
          return ($hash &amp; 0xFFFFFFFF);
      }
  
      echo hash_djb2("one piece");//-233010523
  ?&gt;
  </code></pre>
  
  <p>How to make PHP return the same result as C++ does?</p>