HH\Vector::slice
Returns a subset of the current Vector
starting from a given key up to,
but not including, the element at the provided length from the starting key.
Description
public function slice(
int $start,
int $len,
): Vector<Tv>
Returns a subset of the current Vector
starting from a given key up to,
but not including, the element at the provided length from the starting key.
$start
is 0based. $len
is 1based. So slice(0, 2)
would return the
elements at key 0 and 1.
The returned Vector
will always be a proper subset of this Vector
.
Parameters

int $start
 The starting key of thisVector
to begin the returnedVector
. 
int $len
 The length of the returnedVector
.
Return Values

Vector<Tv>
 AVector
that is a proper subset of the currentVector
starting at$start
up to but not including the element$start + $len
.
Examples
<?hh
namespace Hack\UserDocumentation\API\Examples\Vector\Slice;
$v = Vector {'red', 'green', 'blue', 'yellow'};
// Start at index 1 ('green') and include 3 elements
$v2 = $v>slice(1, 3);
var_dump($v2);
object(HH\Vector)#2 (3) {
[0]=>
string(5) "green"
[1]=>
string(4) "blue"
[2]=>
string(6) "yellow"
}