Quickhash QuickHashIntStringHash::loadFromString

(PECL quickhash >= Unknown)

QuickHashIntStringHash::loadFromString — 이 팩토리 메소드는 문자열에서 해시를 생성합니다.


설명

public static QuickHashIntStringHash::loadFromString(string $contents, int $size = 0, int $options = 0): QuickHashIntStringHash

이 팩토리 메서드는 문자열의 정의에서 새 해시를 만듭니다. 형식은 "loadFromFile"에 사용된 형식과 동일합니다.


매개변수

contents
직렬화된 해시 형식을 포함하는 문자열입니다.
size
구성할 버킷 목록의 양입니다. 전달한 숫자는 자동으로 다음 2의 거듭제곱으로 반올림됩니다. 또한 자동으로 4에서 4194304로 제한됩니다.
options
클래스의 생성자가 취하는 것과 동일한 옵션; 크기 옵션이 무시된다는 점을 제외하고. 해시의 항목 수와 동일하도록 자동 계산되며 최대 제한은 4194304이며 가장 가까운 2의 거듭제곱으로 반올림됩니다.

반환 값

새로운 QuickHashIntStringHash를 반환합니다.


Examples

예제 #1 QuickHashIntStringHash::loadFromString() 예제

                  
<?php
$contents = file_get_contents( dirname( __FILE__ ) . "/simple.hash" );
$hash = QuickHashIntStringHash::loadFromString(
    $contents,
    QuickHashIntStringHash::DO_NOT_USE_ZEND_ALLOC
);
foreach( range( 0, 0x0f ) as $key )
{
    printf( "Key %3d (%2x) is %s\n",
        $key, $key,
        $hash->exists( $key ) ? 'set' : 'unset'
    );
}
?>
                  
                

위의 예는 다음과 유사한 결과를 출력합니다.

Key   0 ( 0) is unset
Key   1 ( 1) is set
Key   2 ( 2) is set
Key   3 ( 3) is set
Key   4 ( 4) is unset
Key   5 ( 5) is set
Key   6 ( 6) is unset
Key   7 ( 7) is set
Key   8 ( 8) is unset
Key   9 ( 9) is unset
Key  10 ( a) is unset
Key  11 ( b) is set
Key  12 ( c) is unset
Key  13 ( d) is set
Key  14 ( e) is unset
Key  15 ( f) is unset