> For the complete documentation index, see [llms.txt](https://arrayutils.docs.present.kim/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://arrayutils.docs.present.kim/methods/c/unshift.md).

# unshift()

{% code title="Example.php" %}

```php
<?php use kim\present\utils\arrays\ArrayUtils;

$arrayUtils = ArrayUtils::from(range(1,5));

//Unshift 0 and 10
$arrayUtils->unshift(0, 10);
// expected output: [0, 10, 1, 2, 3, 4, 5]
```

{% endcode %}

## Syntax

```php
$arrayUtils->unshift(mixed ...$values) : ArrayUtils;
```

### Parameter

* `$values`

  > A values to unshift into array

###

### Return value

* oneself back for method chaining.

## Prefixing

```php
$arrayUtils->unshiftAs(mixed ...$values) : array;
```

```php
ArrayUtils::unshiftFrom(iterable $from, mixed ...$values) : ArrayUtils;
```

```php
ArrayUtils::unshiftFromAs(iterable $from, mixed ...$values) : array;
```

## References

{% content-ref url="/pages/-MKmSpTJX9Uo5R5MdlG4" %}
[push()](/methods/c/push.md)
{% endcontent-ref %}

{% embed url="<https://www.php.net/manual/en/function.array-unshift.php>" %}

{% embed url="<https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/unshift>" %}
