Oihana PHP

tail.php

Table of Contents

Functions

tail()  : array<string|int, mixed>
Returns a new array containing all elements except the first one.

Functions

tail()

Returns a new array containing all elements except the first one.

tail(array<string|int, mixed> $array) : array<string|int, mixed>

If the input array is empty, returns an empty array.

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

The input array.

Tags
example
use function oihana\core\arrays\tail;

$arr = [2, 3, 4];
print_r(tail($arr)); // Outputs: [3, 4]

$empty = [];
print_r(tail($empty)); // Outputs: []

$single = [10];
print_r(tail($single)); // Outputs: []
author

Marc Alcaraz (ekameleon)

since
1.0.0
Return values
array<string|int, mixed>

A new array without the first element.


        
On this page

Search results