[导读]PHP7以上才能安装和使用该数据结构扩展,安装比较简单
PHP7以上才能安装和使用该数据结构扩展,安装比较简单:1. 运行命令 pecl install ds
2. 在php.ini中添加 extension=ds.so
3. 重启PHP或重载配置
Collection Interface:包含本库中所有数据结构通用功能的基本interface。 It guarantees that all structures are traversable, countable, and can be converted to json using json_encode().DsCollection implements Traversable , Countable , JsonSerializable {
/* 方法 */
abstract public void clear ( void )
abstract public DsCollection ( void )
abstract public bool isEmpty ( void )
abstract public array toArray ( void )
}
Hashable Interface:which allows objects to be used as keys.DsHashable {
/* 方法 */
abstract public bool equals ( object $obj )
abstract public mixed hash ( void )
}
Sequence Interface:A Sequence 相当于一个一维的数字key数组, with the exception of a few characteristics: