QuickHashStringIntHash: : loadFromString
(No version information available, might only be in Git)
QuickHashStringIntHash::loadFromString — This factory method creates a hash from a string
Description
$contents
[, int $size
= 0
[, int $options
= 0
]] ) : QuickHashStringIntHashThis factory method creates a new hash from a definition in a string. The format is the same as the one used in "loadFromFile".
Parameters
-
contents
-
The string containing a serialized format of the hash.
-
size
-
The amount of bucket lists to configure. The number you pass in will be automatically rounded up to the next power of two. It is also automatically limited from 4 to 4194304.
-
options
-
The same options that the class' constructor takes; except that the size 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.
Examples
Example #1 QuickHashStringIntHash::loadFromString() example
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash.string" );
$hash = QuickHashStringIntHash::loadFromString(
$contents,
QuickHashStringIntHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
$i = 48712 + $key * 1631;
$k = base_convert( $i, 10, 36 );
echo $k, ' => ', $hash->get( $k ), "\n";
}
?>
The above example will output something similar to:
11l4 => 48712 12uf => 50343 143q => 51974 15d1 => 53605 16mc => 55236 17vn => 56867 194y => 58498 1ae9 => 60129 1bnk => 61760 1cwv => 63391 1e66 => 65022 1ffh => 66653 1gos => 68284 1hy3 => 69915 1j7e => 71546 1kgp => 73177
English translation
You have asked to visit this site in English. For now, only the interface is translated, but not all the content yet.If you want to help me in translations, your contribution is welcome. All you need to do is register on the site, and send me a message asking me to add you to the group of translators, which will give you the opportunity to translate the pages you want. A link at the bottom of each translated page indicates that you are the translator, and has a link to your profile.
Thank you in advance.
Document created the 30/01/2003, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/php-rf-quickhashstringinthash.loadfromstring.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.