The HH\Pair<Tv1, Tv2> class

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, Pairs have reference-like semantics. The elements or a Pair cannot be mutated (i.e. you can't assign to the elements of a Pair) though Pairs may contain mutable objects.

Pairs only support integer keys. If a non-integer key is used, an exception will be thrown. Only keys 0 and 1 will ever exist in a Pair, and these keys will always exist.

Pairs support $m[$k] style syntax for getting values by key. Pairs also support isset($m[$k]) and empty($m[$k]) syntax, and they provide similar semantics to arrays.

Pairs do not support taking elements by reference. If binding assignment (=&) is used with an element of a Pair, or if an element of a Pair is passed by reference, or if a Pair is used with foreach by reference, an exception will be thrown.

Interface synopsis

class Pair implements ConstVector {...}