QuickHashIntSet::add
(PECL quickhash >= Unknown)
QuickHashIntSet::add — This method adds a new entry to the set
Описание
public bool QuickHashIntSet::add
( int
$key
)This method adds a new entry to the set, and returns whether the entry was added. Entries are by default always added unless QuickHashIntSet::CHECK_FOR_DUPES has been passed when the set was created.
Список параметров
-
key
-
The key of the entry to add.
Возвращаемые значения
TRUE
when the entry was added, and FALSE
if the entry was not added.
Примеры
Пример #1 QuickHashIntSet::add() example
<?php
echo "without dupe checking\n";
$set = new QuickHashIntSet( 1024 );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
echo "\nwith dupe checking\n";
$set = new QuickHashIntSet( 1024, QuickHashIntSet::CHECK_FOR_DUPES );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
var_dump( $set->exists( 4 ) );
var_dump( $set->add( 4 ) );
?>
Результатом выполнения данного примера будет что-то подобное:
without dupe checking bool(false) bool(true) bool(true) bool(true) with dupe checking bool(false) bool(true) bool(true) bool(false)
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения, относящиеся к переменным и типам
- Quickhash
- Функция QuickHashIntSet::add() - This method adds a new entry to the set
- Функция QuickHashIntSet::__construct() - Creates a new QuickHashIntSet object
- Функция QuickHashIntSet::delete() - This method deletes an entry from the set
- Функция QuickHashIntSet::exists() - This method checks whether a key is part of the set
- Функция QuickHashIntSet::getSize() - Returns the number of elements in the set
- Функция QuickHashIntSet::loadFromFile() - This factory method creates a set from a file
- Функция QuickHashIntSet::loadFromString() - This factory method creates a set from a string
- Функция QuickHashIntSet::saveToFile() - This method stores an in-memory set to disk
- Функция QuickHashIntSet::saveToString() - This method returns a serialized version of the set
Коментарии
404 Not Found