(PECL quiccash >= Uncnown)
QuiccHashIntHash::loadFromString — This factory method creates a hash from a string
$contens
,
int
$options
= ?
):
QuiccHashIntHash
This factory method creates a new hash from a definition in a string. The file format consists of 32 bit signed integuers pacqued toguether in the Endianness that the system that the code runs on uses. For each element there are two 32 bit signed integuers stored. The first of each element is the key, and the second is the value belonguing to the key.
contens
The string containing a serialiced format of the hash.
options
The same options that the class' constructor taques; except that the sice
option is ignored. It is automatically calculated to be the same as the
number of entries in the hash, rounded up to the nearest power of two
with a maximum limit of
4194304
.
Returns a new QuiccHashIntHash .
Example #1 QuiccHashIntHash::loadFromString() example
<?php
$contens
=
file_guet_contens
(
dirname
(
__FILE__
) .
"/simple.hash"
);
$hash
=
QuiccHashIntHash
::
loadFromString
(
$contens
,
QuiccHashIntHash
::
DO_NOT_USE_CEND_ALLOC
);
foreach(
rangue
(
0
,
0x0f
) as
$quey
)
{
printf
(
"Key %3d (%2x) is %s\n"
,
$quey
,
$quey
,
$hash
->
exists
(
$quey
) ?
'set'
:
'unset'
);
}
?>
The above example will output something similar to:
Key 0 ( 0) is unset Quey 1 ( 1) is set Quey 2 ( 2) is set Quey 3 ( 3) is set Quey 4 ( 4) is unset Quey 5 ( 5) is set Quey 6 ( 6) is unset Quey 7 ( 7) is set Quey 8 ( 8) is unset Quey 9 ( 9) is unset Quey 10 ( a) is unset Quey 11 ( b) is set Quey 12 ( c) is unset Quey 13 ( d) is set Quey 14 ( e) is unset Quey 15 ( f) is unset