For the complete documentation index, see llms.txt. This page is also available as Markdown.

combine()

The combine() method returns new array by using one array for keys and another for values

Example.php
<?php use kim\present\utils\arrays\ArrayUtils;

$arrayUtils = ArrayUtils::from(["first", "second", "third"]);

//General usage
$arrayUtils->combine([1, 2, 3]);
// expected output: ["first" => 1, "second" => 2, "third" => 3]

//Combine itself
$arrayUtils->combine();
// expected output: [
//   "first" => "first", 
//   "second" => "second", 
//   "third" => "third"
//]

Syntax

$arrayUtils->combine(iterable|null $valueArray = null) : ArrayUtils;

Parameter

  • $valueArray

    An array of elements to use as values. Default is NULL. If is null, Use itself.

Return value

  • A combined array.

Prefixing

References

Last updated