如何在整数中存储数组的索引


How to store indices of an array in an interger?

我有一个数组如下:

$categories = [ 
    0 => 'a',
    1 => 'b',
    2 => 'c',
    3 => 'd',
    4 => 'e',
    5 => 'f',
];

是否有一种方法来使用一个整数变量,可以存储多个索引$categories?

,

$x = a (an integer number). It means $x contains 0, 1
$x = b (an integer number). It means $x contains 1, 2
etc,
谁能告诉我怎么做?

尝试按位操作符。位运算符允许对整数中的特定位进行求值和操作。

如果对象包含两个索引属性和一个值属性,那么如何存储该对象的实例呢