push()
The push() method push elements onto the end of array
Example.php
<?php use kim\present\utils\arrays\ArrayUtils;
$arrayUtils = ArrayUtils::from(range(1,5));
//Push 0 and 10
$arrayUtils->push(0, 10);
// expected output: [1, 2, 3, 4, 5, 0, 10]
$arrayUtils->push(mixed ...$values) : ArrayUtils;
$values
A values to push into array
- oneself back for method chaining.
$arrayUtils->pushAs(mixed ...$values) : array;
ArrayUtils::pushFrom(iterable $from, mixed ...$values) : ArrayUtils;
ArrayUtils::pushFromAs(iterable $from, mixed ...$values) : array;
Last modified 2yr ago