Documentation

A
in package

Table of Contents

first()  : mixed
Returns the first element of an array
join()  : string
last()  : mixed
Returns the last element of an array

Methods

first()

Returns the first element of an array

public static first(array<string|int, mixed> $array) : mixed
$array = [ 'cat' => 'miao', 'dog' => 'wuff', 'bird' => 'tweet' ];

$first = A::first($array); // first: 'miao'

Parameters
$array : array<string|int, mixed>

The source array

Return values
mixed

The first element

join()

public static join(mixed $value[, mixed $separator = ', ' ]) : string
Parameters
$value : mixed
$separator : mixed = ', '
Return values
string

last()

Returns the last element of an array

public static last(array<string|int, mixed> $array) : mixed
$array = [ 'cat' => 'miao', 'dog' => 'wuff', 'bird' => 'tweet' ];

$last = A::last($array); // last: 'tweet'

Parameters
$array : array<string|int, mixed>

The source array

Return values
mixed

The last element

Search results