How can I make the PHP version of Bitwise XOR match the javascript version?How to validate an email address in JavaScript?How can I prevent SQL injection in PHP?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?Reference — What does this symbol mean in PHP?How do I remove a particular element from an array in JavaScript?

Lorentz invariance of Maxwell's equations in matter

What dice to use in a game that revolves around triangles?

How long can fsck take on a 30 TB volume?

What's an appropriate age to involve kids in life changing decisions?

How can I test a shell script in a "safe environment" to avoid harm to my computer?

How can I make parentheses stick to formula?

Renting a house to a graduate student in my department

Is it a Munchausen Number?

Why are thrust reversers not used to slow down to taxi speeds?

How to get MAX value using SOQL when there are more than 50,000 rows

How do I minimise waste on a flight?

Are double contractions formal? Eg: "couldn't've" for "could not have"

Row vectors and column vectors (Mathematica vs Matlab)

Ugin's Conjurant vs. un-preventable damage

Is it a good idea to copy a trader when investing?

Identity of a supposed anonymous referee revealed through "Description" of the report

how to find out if there's files in a folder and exit accordingly (in KSH)

Program for finding longest run of zeros from a list of 100 random integers which are either 0 or 1

How to avoid making self and former employee look bad when reporting on fixing former employee's work?

How does weapons training transfer to empty hand?

if i accidentally leaked my schools ip address and someone d doses my school am i at fault

Rusty Chain and back cassette – Replace or Repair?

Why is there a cap on 401k contributions?

Does STATISTICS IO output include Version Store reads?



How can I make the PHP version of Bitwise XOR match the javascript version?


How to validate an email address in JavaScript?How can I prevent SQL injection in PHP?How do JavaScript closures work?How do I remove a property from a JavaScript object?How do I include a JavaScript file in another JavaScript file?How do I make the first letter of a string uppercase in JavaScript?How to replace all occurrences of a string in JavaScriptHow to check whether a string contains a substring in JavaScript?Reference — What does this symbol mean in PHP?How do I remove a particular element from an array in JavaScript?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















How can I make the PHP version of Bitwise XOR match the javascript version?



The javascript version gives me 1080



(f6o5y5^t0u1)+(p6t0k1^l2v2)+(j0u1f6^d4d4)+(p6t0k1^l2v2)


While the PHP gives me 0000



$a = f6o5y5^t0u1 & 0xffffffff;
if ($a & 0x80000000)
$a -= 0x100000000;

$b = p6t0k1^l2v2 & 0xffffffff;
if ($b & 0x80000000)
$b -= 0x100000000;

$c = j0u1f6^d4d4 & 0xffffffff;
if ($c & 0x80000000)
$c -= 0x100000000;

$d = p6t0k1^l2v2 & 0xffffffff;
if ($d & 0x80000000)
$d -= 0x100000000;

echo $a.$b.$c.$d;









share|improve this question

















  • 1





    What are the values of all input variables?

    – Gnudiff
    Mar 23 at 8:59

















0















How can I make the PHP version of Bitwise XOR match the javascript version?



The javascript version gives me 1080



(f6o5y5^t0u1)+(p6t0k1^l2v2)+(j0u1f6^d4d4)+(p6t0k1^l2v2)


While the PHP gives me 0000



$a = f6o5y5^t0u1 & 0xffffffff;
if ($a & 0x80000000)
$a -= 0x100000000;

$b = p6t0k1^l2v2 & 0xffffffff;
if ($b & 0x80000000)
$b -= 0x100000000;

$c = j0u1f6^d4d4 & 0xffffffff;
if ($c & 0x80000000)
$c -= 0x100000000;

$d = p6t0k1^l2v2 & 0xffffffff;
if ($d & 0x80000000)
$d -= 0x100000000;

echo $a.$b.$c.$d;









share|improve this question

















  • 1





    What are the values of all input variables?

    – Gnudiff
    Mar 23 at 8:59













0












0








0








How can I make the PHP version of Bitwise XOR match the javascript version?



The javascript version gives me 1080



(f6o5y5^t0u1)+(p6t0k1^l2v2)+(j0u1f6^d4d4)+(p6t0k1^l2v2)


While the PHP gives me 0000



$a = f6o5y5^t0u1 & 0xffffffff;
if ($a & 0x80000000)
$a -= 0x100000000;

$b = p6t0k1^l2v2 & 0xffffffff;
if ($b & 0x80000000)
$b -= 0x100000000;

$c = j0u1f6^d4d4 & 0xffffffff;
if ($c & 0x80000000)
$c -= 0x100000000;

$d = p6t0k1^l2v2 & 0xffffffff;
if ($d & 0x80000000)
$d -= 0x100000000;

echo $a.$b.$c.$d;









share|improve this question














How can I make the PHP version of Bitwise XOR match the javascript version?



The javascript version gives me 1080



(f6o5y5^t0u1)+(p6t0k1^l2v2)+(j0u1f6^d4d4)+(p6t0k1^l2v2)


While the PHP gives me 0000



$a = f6o5y5^t0u1 & 0xffffffff;
if ($a & 0x80000000)
$a -= 0x100000000;

$b = p6t0k1^l2v2 & 0xffffffff;
if ($b & 0x80000000)
$b -= 0x100000000;

$c = j0u1f6^d4d4 & 0xffffffff;
if ($c & 0x80000000)
$c -= 0x100000000;

$d = p6t0k1^l2v2 & 0xffffffff;
if ($d & 0x80000000)
$d -= 0x100000000;

echo $a.$b.$c.$d;






javascript php bit-manipulation xor bitwise-xor






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 8:56









William CrossWilliam Cross

333




333







  • 1





    What are the values of all input variables?

    – Gnudiff
    Mar 23 at 8:59












  • 1





    What are the values of all input variables?

    – Gnudiff
    Mar 23 at 8:59







1




1





What are the values of all input variables?

– Gnudiff
Mar 23 at 8:59





What are the values of all input variables?

– Gnudiff
Mar 23 at 8:59












1 Answer
1






active

oldest

votes


















0














The syntax is the same, the implementation in your sample is different. For example, the following Javascript:



var x = (1^2)+(3^4)+(5^6)+(4^8);
console.log(x);


Will output x as 25;



The PHP version is the same. For example:



<?=(1^2)+(3^4)+(5^6)+(4^8)?>


Will also render 25.



My guess is you do not have the same values or your syntax is the different in the different languages.






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312139%2fhow-can-i-make-the-php-version-of-bitwise-xor-match-the-javascript-version%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    The syntax is the same, the implementation in your sample is different. For example, the following Javascript:



    var x = (1^2)+(3^4)+(5^6)+(4^8);
    console.log(x);


    Will output x as 25;



    The PHP version is the same. For example:



    <?=(1^2)+(3^4)+(5^6)+(4^8)?>


    Will also render 25.



    My guess is you do not have the same values or your syntax is the different in the different languages.






    share|improve this answer



























      0














      The syntax is the same, the implementation in your sample is different. For example, the following Javascript:



      var x = (1^2)+(3^4)+(5^6)+(4^8);
      console.log(x);


      Will output x as 25;



      The PHP version is the same. For example:



      <?=(1^2)+(3^4)+(5^6)+(4^8)?>


      Will also render 25.



      My guess is you do not have the same values or your syntax is the different in the different languages.






      share|improve this answer

























        0












        0








        0







        The syntax is the same, the implementation in your sample is different. For example, the following Javascript:



        var x = (1^2)+(3^4)+(5^6)+(4^8);
        console.log(x);


        Will output x as 25;



        The PHP version is the same. For example:



        <?=(1^2)+(3^4)+(5^6)+(4^8)?>


        Will also render 25.



        My guess is you do not have the same values or your syntax is the different in the different languages.






        share|improve this answer













        The syntax is the same, the implementation in your sample is different. For example, the following Javascript:



        var x = (1^2)+(3^4)+(5^6)+(4^8);
        console.log(x);


        Will output x as 25;



        The PHP version is the same. For example:



        <?=(1^2)+(3^4)+(5^6)+(4^8)?>


        Will also render 25.



        My guess is you do not have the same values or your syntax is the different in the different languages.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 9:22









        TiggerTigger

        6,61432835




        6,61432835





























            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55312139%2fhow-can-i-make-the-php-version-of-bitwise-xor-match-the-javascript-version%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

            Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript