PHP | Ds\Sequence merge() Function Last Updated : 24 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The Ds\Sequence::merge() function is an inbuilt function in PHP which returns a sequence after adding all given values to the sequence. Syntax: abstract public Ds\Sequence::merge( $values ) : Ds\Sequence Parameter: This function accepts single parameter $values which holds the elements. Return Value: This function returns the sequence adding all the elements. Below programs illustrate the Ds\Sequence::merge() function in PHP: Program 1: php <?php // Create new sequence $seq = new \Ds\Vector([12, 15, 18, 20]); // Merge the sequence and display it var_dump($seq->merge([1, 2, 3])); // Display the sequence element var_dump($seq) ?> Output: object(Ds\Vector)#2 (7) { [0]=> int(12) [1]=> int(15) [2]=> int(18) [3]=> int(20) [4]=> int(1) [5]=> int(2) [6]=> int(3) } object(Ds\Vector)#1 (4) { [0]=> int(12) [1]=> int(15) [2]=> int(18) [3]=> int(20) } Program 2: php <?php // Create new sequence $seq = new \Ds\Vector([12, 15, 18, 20]); // Merge the sequence and display it var_dump($seq->merge(["G", "E", "E", "k", "S"])); ?> Output: object(Ds\Vector)#2 (9) { [0]=> int(12) [1]=> int(15) [2]=> int(18) [3]=> int(20) [4]=> string(1) "G" [5]=> string(1) "E" [6]=> string(1) "E" [7]=> string(1) "k" [8]=> string(1) "S" } Reference: http://php.net/manual/en/ds-sequence.merge.php Comment More infoAdvertise with us Next Article PHP array_​merge() Function V vijay_raj Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-DS\Collection Similar Reads PHP | DsSet merge() Function The Ds\Set::merge() function is an inbuilt function in PHP which returns a set after adding all given values to the set. Syntax: Ds\Set public Ds\Set::merge ( mixed $values ) Parameters: This function accepts single parameter $values which holds the elements. Return Value: This function returns the 1 min read PHP | DsDeque merge() Function The Ds\Deque::merge() function is an inbuilt function in PHP which is used to return the merged Deque after merging all the elements of one Deque with another by adding all the values into a copy and returns that copy. Syntax: public Ds\Deque::merge( $values ) : Ds\Deque Parameters: This function ac 2 min read PHP | DsVector merge() Function The Ds\Vector::merge() function is an inbuilt function in PHP which is used to merge all the elements to the vector. Syntax: Ds\Vector public Ds\Vector::merge( $values ) Parameters: This function accepts a single parameter $values which is the traversable object or array.Return Value: This function 2 min read PHP array_merge_recursive() Function The array_merge_recursive() is an inbuilt function in PHP and is used to merge two or more arrays into a single array recursively. This function is used to merge the elements or values of two or more arrays together into a single array. The merging occurs in such a manner that the values of one arra 3 min read PHP | DsSequence merge() Function The Ds\Sequence::merge() function is an inbuilt function in PHP which returns a sequence after adding all given values to the sequence. Syntax: abstract public Ds\Sequence::merge( $values ) : Ds\Sequence Parameter: This function accepts single parameter $values which holds the elements. Return Value 1 min read PHP array_âmerge() Function The array_merge() function is an inbuilt function in PHP that is used to merge two or more arrays into a single array. This function merges the elements or values of two or more arrays together to make a single array. The merging occurs in such a manner that the values of one array are appended at t 2 min read PHP | DsSet slice() Function The Ds\Set::slice() function is an inbuilt function in PHP which is used to return the sub-set of given range. Syntax: Ds\Set public Ds\Set::slice ( int $index [, int $length ] ) Parameters: This function accepts two parameters as mentioned above and described below: $index: This parameter holds the 2 min read PHP | DsVector reduce() Function The Ds\Vector::reduce() function is an inbuilt function in PHP which reduce the vector to a single value by applying operations in the callback function. Syntax: mixed public Ds\Vector::reduce( $callback, $initial ) Parameters: This function accepts two parameters as mentioned above and described be 2 min read PHP | DsMap reverse() Function The Ds/Map::reverse() function in PHP is used to in-place reverse the elements of a specified Map instance. That is, the function in-place reverses the order of elements present in the specified Map instance. Syntax: Ds\Map public Ds\Map::reverse ( int $position ) Parameter: This function does not a 2 min read PHP | DsDeque slice() Function The Ds\Deque::slice() function is an inbuilt function in PHP which is used to return a sub-Deque which contains elements of the Deque within the index range. Syntax: public Ds\Deque::slice( $index, $length ) : Ds\Deque Parameters: This function accept two parameters as mentioned above and described 2 min read Like