The Judy class

(PECL judy >= 0.1.1)

简介

The Judy class implements the ArrayAccess interface and the Iterator interface. This class, once instantiated, can be accessed like a PHP array.

A PHP Judy object (or Judy Array) can be one of the following type :

Example #1 Judy array example

<?php
    $judy 
= new Judy(Judy::INT_TO_MIXED);
    
$judy[1] = "one";
    
$judy[2] = array('a''b''c');
    
$judy[3] = new Judy(Judy::BITSET);
?>

类摘要

Judy implements ArrayAccess , Iterator {
/* Constants */
const integer BITSET = 1 ;
const integer INT_TO_INT = 2 ;
const integer INT_TO_MIXED = 3 ;
const integer STRING_TO_INT = 4 ;
const integer STRING_TO_MIXED = 5 ;
/* 方法 */
public byCount ( int $nth_index ) : int
public __construct ( int $judy_type )
public count ([ int $index_start = 0 [, int $index_end = -1 ]] ) : int
public __destruct ( void ) : void
public first ([ mixed $index ] ) : mixed
public firstEmpty ([ mixed $index = 0 ] ) : int
public free ( void ) : int
public getType ( void ) : int
public last ([ string $index ] ) : void
public lastEmpty ([ int $index = -1 ] ) : int
public memoryUsage ( void ) : int
public next ( mixed $index ) : mixed
public nextEmpty ( int $index ) : int
public offsetExists ( mixed $offset ) : bool
public offsetGet ( mixed $offset ) : mixed
public offsetSet ( mixed $offset , mixed $value ) : bool
public offsetUnset ( mixed $offset ) : bool
public prev ( mixed $index ) : mixed
public prevEmpty ( mixed $index ) : int
public size ( void ) : void
}

预定义常量

Judy::BITSET

Define the Judy Array as a Bitset with keys as Integer and Values as a Boolean

Judy::INT_TO_INT

Define the Judy Array with key/values as Integer, and Integer only.

Judy::INT_TO_MIXED

Define the Judy Array with keys as Integer and Values of any type.

Judy::STRING_TO_INT

Define the Judy Array with keys as a String and Values as Integer, and Integer only.

Judy::STRING_TO_MIXED

Define the Judy Array with keys as a String and Values of any type.

Table of Contents

User Contributed Notes

There are no user contributed notes for this page.