-1

I need a function in PHP which does the same as

BITXOR(ASC("a"), 9)

does in Visual FoxPro 9 (the result is 104).

I don't code PHP ever, but the function XOR doesn't the same, I do:

ord($lcCaract) xor $lnKey

where $lcCaract = "a" and $lnKey = 9 and the result is 0.

Any help?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Alf
  • 67
  • 1
  • 1
  • 9
  • Did you try reading the documentation of [Bitwise operators](http://php.net/manual/en/language.operators.bitwise.php)? – Barmar Jun 02 '17 at 00:45
  • Or google "php xor". The Internet can answer your questions so easily, why are people so helpless? – Barmar Jun 02 '17 at 00:46
  • @Barmar It seems that you (and I) have fallen onto deaf ears. I placed [a comment](https://stackoverflow.com/questions/44318934/bitwise-xor-exclusive-or-in-php#comment75643899_44319245) under what the [OP posted as an answer](https://stackoverflow.com/a/44319245/1415724), but don't see it as being one and haven't responded to that neither. Am not quite sure if that should be flagged as "not an answer". – Funk Forty Niner Jun 02 '17 at 01:05

1 Answers1

1

$a ^ $b Xor (exclusive or) Bits that are set in $a or $b but not both are set.

so Try below

echo $result=ord('a') ^ 9;

ord Return the ASCII value in PHP just like ASC in foxpro

Follow this http://php.net/manual/en/language.operators.bitwise.php

sumit
  • 15,003
  • 12
  • 69
  • 110