first()
The first() method returns first value
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(["Apple", "Banana", "Carrot"]);
//Gets first value
$arrayUtils->first();
// expected output: "Apple"
$arrayUtils->first() : mixed;
- A first value of array. If array is empty, returns
NULL
.
ArrayUtils::firstFrom(iterable $from) : mixed;
Last modified 2yr ago