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

List.copy

copy($useReferences = false)

Description

Copy the List into a new List.

Any elements that are Lists or Maps will also be copied, recursively.

If $useReferences is true, child List or Map objects will point to the same objects as the original.

$list1 = [1, 2, 3];
$list2 = $list1.copy();

$list1[0] = 11;
$list2[0] = 22;

print($list1);  //= [11, 2, 3]
print($list2);  //= [22, 2, 3]