ListInterface
extends
Iterator, JsonSerializable, Countable
in
ListInterface
Tags
Table of Contents
Methods
- append() : void
- Appends a list to another.
- first() : mixed
- Get the first value of list
- get() : mixed
- Get a value by its key
- has() : bool
- Check if a given key exists on list
- last() : mixed
- Get the last value of list
- push() : void
- Add a value to list
- put() : void
- Put an object into list on given key
- remove() : void
- Remove a value by its key on list
- toArray() : array<string|int, mixed>
- Return an array representation for list
- values() : array<string|int, mixed>
- Return an array with list values only
Methods
append()
Appends a list to another.
public
append(ListInterface $list) : void
Parameters
- $list : ListInterface
-
ListInterface object to append.
first()
Get the first value of list
public
first() : mixed
get()
Get a value by its key
public
get(int|string $key) : mixed
Parameters
- $key : int|string
-
key to verify on list.
has()
Check if a given key exists on list
public
has(int|string $key) : bool
Parameters
- $key : int|string
-
Key to verify on list.
Return values
bool —True if key exists, false otherwise.
last()
Get the last value of list
public
last() : mixed
push()
Add a value to list
public
push(mixed $value) : void
Parameters
- $value : mixed
-
Value to add.
put()
Put an object into list on given key
public
put(int|string $key, mixed $value) : void
Parameters
- $key : int|string
-
KeyType for manage the value.
- $value : mixed
-
Value to add.
remove()
Remove a value by its key on list
public
remove(int|string $key) : void
Parameters
- $key : int|string
-
key to remove from list.
toArray()
Return an array representation for list
public
toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>values()
Return an array with list values only
public
values() : array<string|int, mixed>