在这个奇怪的数组键构造中,这个按位或做什么?

Can someone explain to me what this means?? I have never seen this construct - taken from the Prestashop doc

foreach ( $languages as $language )
{
  echo '<div id="test_' . $language['id_lang'|'id_lang'] .... // <-- What the??
  // ... 
}

$language contains the following keys:

Array
(
    [id_lang] => 1
    [name] => English (English)
    // and others... 
)

The result is that it takes the value of $language["id_lang"] - 1. But I don't understand the syntax and can't find any documentation about it.

This php -a session shows that it's totally meaningless:

php > $value = 'something'|'something';
php > echo $value;
something
php > $arr = array('abc' => 1, 'def' => 2);
php > echo $arr['abc'|'abc'];
1
php > echo $arr['def'|'def'];
2

Basically, if you "bitwise or" anything by itself, you get the original value. This property is called idempotence in mathematics. For further info, read:

Honestly, the original author of that code had no idea what they were doing.

What that does is use the bitwise operator on the ASCII values of the characters in the string "id_lang", although why they are doing this is beyond me, since the result is always going to be the same.

To elaborate a little bit, let's say (for convenience) that we're using ASCII, where each character is encoded as a single byte. Let's look at what happens when it does the comparison for the binary representation of the first character (i is 105, which in binary is 01101001):

   "i": 01101001
OR "i": 01101001
      ___________
      = 01101001
      = "i"

0|0 is 0, 1|1 is 1, so inevitably all bits remain unchanged.

It's not doing anything, strangely enough.

var_dump('id_lang'|'id_lang');
#=> string(7) "id_lang"

http://ideone.com/zXdRMO

Even if it was doing something, using a bitwise operator on a string-based array key certainly feels like code smell to me.