Arrays
in component
Helpful functions for managing arrays.
Table of Contents
Methods
- insertAfterKey() : array<string|int, mixed>
- Inserts an array into another array right after the specified key.
- insertBeforeKey() : array<string|int, mixed>
- Inserts an array into another array right before the specified key.
Methods
insertAfterKey()
Inserts an array into another array right after the specified key.
public
static insertAfterKey(mixed $array, mixed $key, mixed $value) : array<string|int, mixed>
$array — source array. $key — key after which the values are inserted. $value — array of elements to insert.
Parameters
- $array : mixed
- $key : mixed
- $value : mixed
Return values
array<string|int, mixed> —New array; the source array unchanged if the key is not found.
insertBeforeKey()
Inserts an array into another array right before the specified key.
public
static insertBeforeKey(mixed $array, mixed $key, mixed $value) : array<string|int, mixed>
$array — source array. $key — key before which the values are inserted. $value — array of elements to insert.
Parameters
- $array : mixed
- $key : mixed
- $value : mixed
Return values
array<string|int, mixed> —New array; the source array unchanged if the key is not found.