I have a javascript code:
var c = 267414715;
var d = c ^ ("0x81BE16CD");
Result is -1907459466
I can't seem to get a PHP equivalent. Have tried the following:
<?php
$c=267414715;
$d=$c ^ hexdec("0x81BE16CD");
echo "With hexdec: $d
";
$d=$c ^ base_convert("0x81BE16CD", 16, 2);
echo "With base_convert(2): $d
";
$d=$c ^ base_convert("0x81BE16CD", 16, 10);
echo "With base_convert(10): $d
";
?>
Output:
With hexdec: 2387507830
With base_convert(2): 9223372036587361092
With base_convert(10): 2387507830
Can someone please point out the correct equivalent code, and also explain how the different versions (base_convert / hexdec / "correct" equivalent differ in their working).