Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

splobjectstorage(3) [php man page]

SPLOBJECTSTORAGE(3)							 1						       SPLOBJECTSTORAGE(3)

The SplObjectStorage class

INTRODUCTION
The SplObjectStorage class provides a map from objects to data or, by ignoring data, an object set. This dual purpose can be useful in many cases involving the need to uniquely identify objects. CLASS SYNOPSIS
SplObjectStorage SplObjectStorageCountableIteratorSerializableArrayAccess Methods o public void SplObjectStorage::addAll (SplObjectStorage $storage) o public void SplObjectStorage::attach NULL (object $object, [mixed $data]) o public bool SplObjectStorage::contains (object $object) o public int SplObjectStorage::count (void ) o public object SplObjectStorage::current (void ) o public void SplObjectStorage::detach (object $object) o public string SplObjectStorage::getHash (object $object) o public mixed SplObjectStorage::getInfo (void ) o public int SplObjectStorage::key (void ) o public void SplObjectStorage::next (void ) o public bool SplObjectStorage::offsetExists (object $object) o public mixed SplObjectStorage::offsetGet (object $object) o public void SplObjectStorage::offsetSet NULL (object $object, [mixed $data]) o public void SplObjectStorage::offsetUnset (object $object) o public void SplObjectStorage::removeAll (SplObjectStorage $storage) o public void SplObjectStorage::removeAllExcept (SplObjectStorage $storage) o public void SplObjectStorage::rewind (void ) o public string SplObjectStorage::serialize (void ) o public void SplObjectStorage::setInfo (mixed $data) o public void SplObjectStorage::unserialize (string $serialized) o public bool SplObjectStorage::valid (void ) EXAMPLES
Example #1 SplObjectStorage as a set <?php // As an object set $s = new SplObjectStorage(); $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $s->attach($o1); $s->attach($o2); var_dump($s->contains($o1)); var_dump($s->contains($o2)); var_dump($s->contains($o3)); $s->detach($o2); var_dump($s->contains($o1)); var_dump($s->contains($o2)); var_dump($s->contains($o3)); ?> The above example will output: bool(true) bool(true) bool(false) bool(true) bool(false) bool(false) Example #2 SplObjectStorage as a map <?php // As a map from objects to data $s = new SplObjectStorage(); $o1 = new StdClass; $o2 = new StdClass; $o3 = new StdClass; $s[$o1] = "data for object 1"; $s[$o2] = array(1,2,3); if (isset($s[$o2])) { var_dump($s[$o2]); } ?> The above example will output: array(3) { [0]=> int(1) [1]=> int(2) [2]=> int(3) } PHP Documentation Group SPLOBJECTSTORAGE(3)

Check Out this Related Man Page

RECURSIVEARRAYITERATOR(3)						 1						 RECURSIVEARRAYITERATOR(3)

The RecursiveArrayIterator class

INTRODUCTION
This iterator allows to unset and modify values and keys while iterating over Arrays and Objects in the same way as the ArrayIterator. Additionally it is possible to iterate over the current iterator entry. CLASS SYNOPSIS
RecursiveArrayIterator RecursiveArrayIteratorextends ArrayIteratorRecursiveIterator Methods o public RecursiveArrayIterator RecursiveArrayIterator::getChildren (void ) o public bool RecursiveArrayIterator::hasChildren (void ) Inherits o public void ArrayIterator::append (mixed $value) o public void ArrayIterator::asort (void ) o public ArrayIterator::__construct ([mixed $array = array()], [int $flags]) o public int ArrayIterator::count (void ) o public mixed ArrayIterator::current (void ) o public array ArrayIterator::getArrayCopy (void ) o public void ArrayIterator::getFlags (void ) o public mixed ArrayIterator::key (void ) o public void ArrayIterator::ksort (void ) o public void ArrayIterator::natcasesort (void ) o public void ArrayIterator::natsort (void ) o public void ArrayIterator::next (void ) o public void ArrayIterator::offsetExists (string $index) o public mixed ArrayIterator::offsetGet (string $index) o public void ArrayIterator::offsetSet (string $index, string $newval) o public void ArrayIterator::offsetUnset (string $index) o public void ArrayIterator::rewind (void ) o public void ArrayIterator::seek (int $position) o public string ArrayIterator::serialize (void ) o public void ArrayIterator::setFlags (string $flags) o public void ArrayIterator::uasort (string $cmp_function) o public void ArrayIterator::uksort (string $cmp_function) o public string ArrayIterator::unserialize (string $serialized) o public bool ArrayIterator::valid (void ) PHP Documentation Group RECURSIVEARRAYITERATOR(3)
Man Page