The Ds\Sequence::slice() function is an inbuilt function in PHP which is used to return the subsequence of given range.
Ds\Sequence abstract public Ds\Sequence::slice ( int $index [, int $length ] )
Parameters: This function accepts two parameters as mentioned above and described below:
- $index: This parameter hold the starting index of subsequence. The index value can be positive and negative. If the index value is positive then it starts at the index of sequence and if the index value is negative then it sequence starts from ends.
- $length: This parameter holds the length of subsequence. This parameter can take positive and negative values. If length is positive then subsequence size is equal to a given length and if the length is negative then the sequence will stop that many values from the end.
Return value: This function returns the subsequence of given range.
Below programs illustrate the Ds\Sequence::slice() function in PHP:
Ds\Vector Object (  => 6  => 9  => 10  => 15  => 20 ) Ds\Vector Object (  => 3  => 6 ) Ds\Vector Object (  => 6  => 9  => 10 )
Ds\Vector Object (  => for ) Ds\Vector Object ( ) Ds\Vector Object (  => Geeks  => GFG  => Abc )
- PHP Ds\Map slice() Function
- PHP | Ds\Set slice() Function
- Node.js | slice() function
- PHP | Ds\Deque slice() Function
- PHP | Ds\Vector slice() Function
- Node.js | Buffer.slice() Method
- CSS | border-image-slice Property
- How to get the function name inside a function in PHP ?
- PHP | max( ) Function
- PHP | sin( ) Function
- PHP | tan( ) Function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.