> 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/s/from.md).

# static from()

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

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

var_export(ArrayUtils::from([3,6,9]));
// expected output: ArrayUtils(array(3, 6, 9))

var_export(ArrayUtils::from([1, 2, 3], function($x){ return $x + $x; }));
// expected output: ArrayUtils(array(2, 4, 9))
```

{% endcode %}

## Syntax

```php
ArrayUtils::from(iterable $iterable, ?callable $mapFn = null) : ArrayUtils
```

### Parameter

* `$iterable`&#x20;

  > Iterable object to convert to an array.
* `$mapFn`  <img src="/files/-MKk9YjCz_YkVR1YiRy-" alt="" data-size="line">&#x20;

  > Map function to call on every element of the array.\
  > Default is `NULL` . If is null, not execute map function.

### Return value

* A new `ArrayUtils` instance.

## References

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