Use BigMap instances in PHP and BigMap instances in PHP. PHP uses BigMap instances. PHP uses BigMap instances. The so-called Bit-map in php uses a bit to mark the Value corresponding to an element, and the Key is the element. Because BigMap instances are used in PHP, BigMap instances are used in PHP.
<? Php // The so-called Bit-map uses a bit to mark the Value corresponding to an element, and the Key is the element. Because Bit is used to store data, the storage space can be greatly reduced. /* If N = 1; the applied memory space is int a [2]; suppose N = 10000000, then we need to apply for the memory size of int a [1 + N/32], where: a [0] occupies 32 of the memory and can correspond to the decimal number 0-31, and so on: 1. evaluate the subscript of 0-n in array a: n/32 2. evaluate the number in 0-N corresponding to 0-31: N % 32 = M3. use shift 0-31 to make the corresponding 32bit 1: 1 <
> SHIFT here is equivalent to intval ($ I/32); // $ I & $ this-> mask here is equivalent to $ I % $ this-> mask, remainder @ $ this-> bitArray [$ I >>$ this-> shift] & = ~ (1 <($ I & $ this-> mask);}/** $ I corresponds to 1 */function setbit ($ I) {@ $ this-> bitArray [$ I >>$ this-> shift] | = (1 <($ I & $ this-> mask ));} // test whether the test bit is 1 function testbit ($ I) {return $ this-> bitArray [$ I >>$ this-> shift] & (1 <($ I & $ this-> mask ));}} $ oBig = new bigMap (); $ oBig-> setbit (30); var_dump ($ oBig-> testbit (2); var_dump ($ oBig-> bitArray ); echo decbin ($ oBig-> bitArray [0]),"
";
Php // The so-called Bit-map is to use a bit to mark the Value corresponding to an element, and the Key is the element. Because Bit is used as the unit...