2 `Vector` is a stack
-like collection. HHVM provides a native implementation
3 for this class. The PHP class definition below is not actually used at run
4 time
; it is simply provided
for the typechecker and
for developer reference.
6 Like all objects in PHP
, `Vector`s have reference
-like semantics. When a
7 caller passes a `Vector` to a callee
, the callee can modify the `Vector` and
8 the caller will see the changes. `Vector`s
do not have
"copy-on-write"
11 `Vector`s only support
integer keys.
If a non
-integer key is used
, an
12 exception will be thrown.
14 `Vector`s support `$m
[$k
]` style syntax
for getting and setting
values by
15 key. `Vector`s also support `isset
($m
[$k
])` and `empty
($m
[$k
])` syntax
, and
16 they provide similar semantics as arrays. Elements can be added to a
17 `Vector` using `$m
[] = ..` syntax.
19 `Vector`s
do not support iterating
while new elements are being added or
20 elements are being removed. When a new element is added or removed
, all
21 iterators that point to the `Vector` shall be considered invalid.
23 @guide
/hack
/collections
/introduction
24 @guide
/hack
/collections
/classes