Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9134865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:44:23+00:00 2026-06-17T08:44:23+00:00

I want to XOR the binary but the result is still wrong xor xor

  • 0

I want to XOR the binary but the result is still wrong xor xor example script:

function _xor($text,$key){
    for($i=0; $i<strlen($text); $i++){
            for($j=0; $j<strlen($key);$j++){
                $text[$i] = $text[$i]^$key[$j];
        }
    }
    return $text;
}

and this is the result :

10011110

should result xor between

01100001
01100010
--------
00000011

please give me the right answer

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T08:44:24+00:00Added an answer on June 17, 2026 at 8:44 am
    function _xor($text,$key){
        for($i=0; $i<strlen($text); $i++){
            $text[$i] = intval($text[$i])^intval($key[$i]);
        }
        return $text;
    }
    
    echo  _xor('01100001','01100010');
    

    Before you use ^, you should first convert string to int

    There not need use two loops which are wrong, just one is ok.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to Bitwise-XOR a string (actually its binary representation) with a KEY. The
Want to run javascript function from parent window in child window Example I have
Want the function to sort the table by HP but if duplicate HPs then
Want to code a key pad for an calculator. What I want to make
Given two STL sets, I want to find out the XOR of them. Is
I want to implement a kind of xor constraint on foreign keys in mysql
I am trying to create a truth table for the function F=(A&B) XOR (C&D').
I have problem with encoding data in Oracle database. I want to xor string
I wrote 2 funcs that work good, but I want to change part of
I want to have a function that evaluates 2 bool vars (like a truth

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.