HH\Vector

Vector is a stack-like collection

HHVM provides a native implementation for this class. The PHP class definition below is not actually used at run time; it is simply provided for the typechecker and for developer reference.

Like all objects in PHP, Vectors have reference-like semantics. When a caller passes a Vector to a callee, the callee can modify the Vector and the caller will see the changes. Vectors do not have "copy-on-write" semantics.

Vectors only support integer keys. If a non-integer key is used, an exception will be thrown.

Vectors support $m[$k] style syntax for getting and setting values by key. Vectors also support isset($m[$k]) and empty($m[$k]) syntax, and they provide similar semantics as arrays. Elements can be added to a Vector using $m[] = .. syntax.

Vectors do not support iterating while new elements are being added or elements are being removed. When a new element is added or removed, all iterators that point to the Vector shall be considered invalid.

Guides

Interface Synopsis

namespace HH;

final class Vector implements \MutableVector<Tv> {...}

Public Methods