protected function subtractBinary($left, $right) {
        $len    = max(strlen($left), strlen($right));
        $left   = str_pad($left, $len, chr(0), STR_PAD_LEFT);
        $right  = str_pad($right, $len, chr(0), STR_PAD_LEFT);
        $right  = $this->compliment($right);
        $result = $this->addBinary($left, $right);
        if (strlen($result) > $len) {
            // Positive Result
            $carry  = substr($result, 0, -1 * $len);
            $result = substr($result, strlen($carry));
            return array(
                '',
                $this->addBinary($result, $carry)
            );
        }
        return array('-', $this->compliment($result));
    }
protected function subtractBinary($left, $right) {
        $len    = max(strlen($left), strlen($right));
        $left   = str_pad($left, $len, chr(0), STR_PAD_LEFT);
        $right  = str_pad($right, $len, chr(0), STR_PAD_LEFT);
        $right  = $this->compliment($right);
        $result = $this->addBinary($left, $right);
        if (strlen($result) > $len) {
            // Positive Result
            $carry  = substr($result, 0, -1 * $len);
            $result = substr($result, strlen($carry));
            return array(
                '',
                $this->addBinary($result, $carry)
            );
        }
        return array('-', $this->compliment($result));
    }
protected function subtractBinary ( $ left , $ right ) { $ len = max ( strlen ( $ left ) , strlen ( $ right ) ) ; $ left = str_pad ( $ left , $ len , chr ( 0 ) , STR_PAD_LEFT ) ; $ right = str_pad ( $ right , $ len , chr ( 0 ) , STR_PAD_LEFT ) ; $ right = $ this -> compliment ( $ right ) ; $ result = $ this -> addBinary ( $ left , $ right ) ; if ( strlen ( $ result ) > $ len ) { // Positive Result $ carry = substr ( $ result , 0 , - 1 * $ len ) ; $ result = substr ( $ result , strlen ( $ carry ) ) ; return array ( '' , $ this -> addBinary ( $ result , $ carry ) ) ; } return array ( '-' , $ this -> compliment ( $ result ) ) ; }
Subtract two binary strings using 256's compliment

@param string $left  The left argument
@param string $right The right argument

@return string The binary result
Subtract two binary strings using 256 s compliment