Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function react_str_replace(string $units, ?string $exclude = null): int
- {
- if($exclude)
- {
- $units = str_replace(array($exclude, strtoupper($exclude)), '', $units);
- }
- $len = strlen($units);
- $i = 0;
- while($i<$len-1)
- {
- $diff = ord($units[$i]) - ord($units[$i+1]);
- if((($diff ^ ($diff >> 31)) - ($diff >> 31)) === 32)
- {
- $units = substr($units, 0, $i) . substr($units, $i+2);
- if($i) $i--;
- $len -= 2;
- } else {
- $i++;
- }
- }
- return $len;
- }
Advertisement
Add Comment
Please, Sign In to add comment