Version: v0.6.1 - Beta.  We welcome contributors & feedback.  THanks!


insertAll($list, $index)


Insert multiple elements into a List.

If index is positive, it inserts before that position.
If index is negative, it inserts after that position, counting from the end.

To add the elements to the end of a List, use pushAll.

$list1 = ['a', 'b'];
$list2 = ['X', 'Y'];

$list1.insertAll($list2, 0);
//= ['X', 'Y', 'a', 'b']

$list1.insertAll($list2, -2);
//= ['a', 'X', 'Y', 'b']

See Also