-
Notifications
You must be signed in to change notification settings - Fork 1
array_swap
Hyomoto edited this page Jun 13, 2021
·
2 revisions
Jump To | Go Back |
Arguments |
---|
Returns: array
Throws: InvalidArgumentType, IndexOutOfBounds
Performs an in-place swap of the contents of the provided array. If an array is not provided, or the indexes are not integers, InvalidArgumentType will be thrown. If the indexes are outside the bounds of the array, IndexOutOfBounds will be thrown.
array_swap( ["a", "b", "c"], 0, 1 );
Output: ["b", "a", "c"]
Name | Type | Purpose |
---|---|---|
array | array |
The array to reverse |
a | int |
The first element to swap |
b | int |
The second element to swap |
Devon Mullane 2020