We're looking to switch to a PHP7 server and are running some compatibility checks on existing code of a website. One of the problems found is with the following function and the Bitwise shifts by a negative number.
Apparently this will throw errors in PHP7. I'll admit I don't fully understand how this arithmetic works, but I was wondering if anyone had a suggesting on how to modify the function to #1 maintain the functionality and #2 become PHP7 compliant.
/**
* Right shift with zero fill.
*
* @param integer $a number to shift
* @param integer $b number of bits to shift
* @return integer
*/
public function zeroFill($a, $b){
return ($a >= 0) ? ($a >> $b) : ($a >> $b) & (PHP_INT_MAX >> ($b - 1));
}