Core Function InsertArray
(→Return Value) |
(→arrays) |
||
Line 22: | Line 22: | ||
One or more arrays to add to the array. | One or more arrays to add to the array. | ||
+ | |||
+ | Note - Arrays are required here and an exception will trigger if these parameters are not arrays. | ||
+ | |||
+ | To avoid issues see the example below for casting a normal value as an array. | ||
=== Return Value === | === Return Value === |
Revision as of 09:40, 26 August 2013
InsertArray( <array>, <id>, <arrays> )
Contents |
Description
Add arrays to an array at a given location
Parameters
array
The array to use.
id
Location to insert to.
Note - If location doesnt exist it will be created and the void between arrays end and your new index will be empty strings.
arrays
One or more arrays to add to the array.
Note - Arrays are required here and an exception will trigger if these parameters are not arrays.
To avoid issues see the example below for casting a normal value as an array.
Return Value
Success - Returns how many elements were done.
Failure - Returns false.
Remarks
Rather than adding the array as a value in a single index it will unravel the array and insert its values as if each value had been passed individually with insert().
Example
Example of just inserting one array
my $arr = array("One", "Five", "Six"); my $otherArr = array("Two", "Three", "Four"); insertArray($arr, 1, $otherArr); printr($arr);
Exampkle of inserting more than one array at a time
my $arr = array("One", "Six"); my $otherArr = array("Two", "Three"); my $anotherArr = array("Four", "Five"); insertArray($arr, 1, $otherArr, $anotherArr); printr($arr);