copywithinArray

method copies array elements to another position in the array. overwrites the existing values and does not add items to the array.

Syntax

copywithinArray

Returns

returns (array) result

Parameters

array_source (array)
source array
target (integer)
The index (position) to copy the elements to.
start (integer)
Optional. The start index (position). Default is 0.
end (integer)
Optional. The end index (position). Default is the array length.

Usage

example

echo(objectToString(copywithinArray([0,1,2,3,4,5], 1, 0, 2)));

output: [ 0, 0, 1, 3, 4, 5 ]