title: how to bitwise shift a string in php?
body: <p>i want to shift a 16-bit variable in Php.
  but my code is not working.
  its just shifts the Lowest nibbles of each Byte. and leave The High nibble unchanged.
  first and third nibble shifts fine.
  but second and fourth is not.</p>
  
  <pre><code>public static function leftShift2Byte($in){
       $strarr = str_split($in);
       if($strarr[1]&gt;chr(127)){
           $strarr[1] = $strarr[1]&lt;&lt;1;
           $strarr[0] = $strarr[0]&lt;&lt;1;
           $strarr[0]++;
       }else{
           $strarr[1] = $strarr[1]&lt;&lt;1;
           $strarr[0] = $strarr[0]&lt;&lt;1;
       }
       return $strarr[0].$strarr[1];
   } 
  </code></pre>