HH\Vector::toMap
Returns an integer-keyed Map
based on the values of the current Vector
public function toMap(): Map<int, Tv>;
Returns
Map<int, Tv>
- AMap
that has the integer keys and associated values of the currentVector
.
Examples
$v = Vector {'red', 'green', 'blue', 'yellow'};
$map = $v->toMap();
var_dump($map is \HH\Map<_, _>);
var_dump($map->keys());
var_dump($map);
bool(true)
object(HH\Vector)#3 (4) {
[0]=>
int(0)
[1]=>
int(1)
[2]=>
int(2)
[3]=>
int(3)
}
object(HH\Map)#2 (4) {
[0]=>
string(3) "red"
[1]=>
string(5) "green"
[2]=>
string(4) "blue"
[3]=>
string(6) "yellow"
}