lay3478 Posted December 13, 2018 Share Posted December 13, 2018 I came across usage of ^= in one the password hashing codes and am trying to find what this operator means in PHP. Link to comment Share on other sites More sharing options...
gw1500se Posted December 13, 2018 Share Posted December 13, 2018 Syntax error. Link to comment Share on other sites More sharing options...
mac_gyver Posted December 13, 2018 Share Posted December 13, 2018 it's actual a combined assignment and bitwise Xor (exclusive or). the starting value on the left is Xor'ed with the value on the right and becomes the new value on the left. Link to comment Share on other sites More sharing options...
requinix Posted December 13, 2018 Share Posted December 13, 2018 Basically every "$x symbol= $y" means "$x = $x symbol $y". So the question is really more about what ^ means. Convenient list of operators Link to comment Share on other sites More sharing options...
gw1500se Posted December 13, 2018 Share Posted December 13, 2018 Oops. Apologies. I misread the syntax. Link to comment Share on other sites More sharing options...
Barand Posted December 13, 2018 Share Posted December 13, 2018 For example $a = 1010 $b = 1111 $b ^= $a // Xor $b = 0101 $b ^= $a // repeat Xor $b = 1111 // $b restored Link to comment Share on other sites More sharing options...
lay3478 Posted December 13, 2018 Author Share Posted December 13, 2018 Thanks @Barand Link to comment Share on other sites More sharing options...
lay3478 Posted December 13, 2018 Author Share Posted December 13, 2018 Thanks everyone. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.