[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-8415":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":16,"forks30d":16,"starsTrendScore":19,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":24,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":31,"readmeContent":32,"aiSummary":33,"trendingCount":16,"starSnapshotCount":16,"syncStatus":19,"lastSyncTime":34,"discoverSource":35},8415,"map","aimeos\u002Fmap","aimeos","PHP arrays and collections made easy","http:\u002F\u002Fphp-map.org",null,"PHP",4294,16,8,1,0,5,21,2,60.29,"MIT License",false,"4.x",true,[26,27,5,28,29,30],"array","collection","php","php-arrays","php-map","2026-06-12 04:00:39","\u003Ca class=\"badge\" href=\"https:\u002F\u002Fapp.circleci.com\u002Fprojects\u002Fgithub\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fdl.circleci.com\u002Fstatus-badge\u002Fimg\u002Fgh\u002Faimeos\u002Fmap\u002Ftree\u002F4.x.svg?style=shield\" alt=\"Build Status\" height=\"20\">\u003C\u002Fa>\n\u003Ca class=\"badge\" href=\"https:\u002F\u002Fcoveralls.io\u002Fgithub\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fcoveralls.io\u002Frepos\u002Fgithub\u002Faimeos\u002Fmap\u002Fbadge.svg\" alt=\"Coverage Status\" height=\"20\">\u003C\u002Fa>\n\u003Ca class=\"badge\" href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fposer.pugx.org\u002Faimeos\u002Fmap\u002Flicense.svg\" alt=\"License\" height=\"20\">\u003C\u002Fa>\n\u003Ca class=\"badge\" href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fposer.pugx.org\u002Faimeos\u002Fmap\u002Fv\u002Fstable\" alt=\"Latest Stable Version\" height=\"20\">\u003C\u002Fa>\n\u003Ca class=\"badge\" href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fbadgen.net\u002Fgithub\u002Fstars\u002Faimeos\u002Fmap\" alt=\"Stars\" height=\"20\">\u003C\u002Fa>\n\u003Ca class=\"badge\" href=\"https:\u002F\u002Fpackagist.org\u002Fpackages\u002Faimeos\u002Fmap\">\u003Cimg src=\"https:\u002F\u002Fposer.pugx.org\u002Faimeos\u002Fmap\u002Fdownloads\" alt=\"Downloads\" height=\"20\">\u003C\u002Fa>\n\n# PHP arrays and collections made easy\n\nEasy and elegant handling of PHP arrays by using an array-like collection object\nas offered by jQuery and Laravel Collections.\n\n```bash\ncomposer req aimeos\u002Fmap\n```\n\nSupported PHP versions:\n\n* PHP 8+ (4.x)\n* PHP 7.1+ (3.x)\n\n**Table of contents**\n\n* [Why PHP Map](#why-php-map)\n* [List of methods](#methods)\n    * [Create](#create)\n    * [Access](#access)\n    * [Add](#add)\n    * [Aggregate](#aggregate)\n    * [Debug](#debug)\n    * [Order](#order-by)\n    * [Shorten](#shorten)\n    * [Test](#test)\n    * [Mutate](#mutate)\n    * [Misc](#misc)\n* [Documentation](#method-documentation)\n* [Custom methods](#custom-methods)\n* [Performance](#performance)\n* [Upgrade guide](#upgrade-guide)\n\n## Why PHP Map\n\n**Instead of:**\n\n```php\n$list = [['id' => 'one', 'value' => 'value1'], ['id' => 'two', 'value' => 'value2'], null];\n$list[] = ['id' => 'three', 'value' => 'value3'];    \u002F\u002F add element\nunset( $list[0] );                                   \u002F\u002F remove element\n$list = array_filter( $list );                       \u002F\u002F remove empty values\nsort( $list );                                       \u002F\u002F sort elements\n$pairs = array_column( $list, 'value', 'id' );       \u002F\u002F create ['three' => 'value3']\n$value = reset( $pairs ) ?: null;                    \u002F\u002F return first value\n```\n\n**Only use:**\n\n```php\n$list = [['id' => 'one', 'value' => 'value1'], ['id' => 'two', 'value' => 'value2'], null];\n$value = map( $list )                                \u002F\u002F create Map\n    ->push( ['id' => 'three', 'value' => 'value3'] ) \u002F\u002F add element\n    ->remove( 0 )                                    \u002F\u002F remove element\n    ->filter()                                       \u002F\u002F remove empty values\n    ->sort()                                         \u002F\u002F sort elements\n    ->col( 'value', 'id' )                           \u002F\u002F create ['three' => 'value3']\n    ->first();                                       \u002F\u002F return first value\n```\n\n**You can still use:**\n\n```php\n$map[] = ['id' => 'three', 'value' => 'value3'];\n$value = $map[0];\ncount( $map );\nforeach( $map as $key => value );\n```\n\n**Use callbacks:**\n\nAlso, the map object allows you to pass anonymous functions to a lot of methods, e.g.:\n\n```php\n$map->each( function( $val, $key ) {\n\techo $key . ': ' . $val;\n} );\n```\n\n**jQuery style:**\n\nIf your map elements are objects, you can call their methods for each object and get\nthe result as new map just like in jQuery:\n\n```php\n\u002F\u002F MyClass implements setStatus() (returning $this) and getCode() (initialized by constructor)\n\n$map = Map::from( ['a' => new MyClass( 'x' ), 'b' => new MyClass( 'y' )] );\n$map->setStatus( 1 )->getCode()->toArray();\n```\n\nThis will call `setStatus( 1 )` on both objects. If `setStatus()` implementation\nreturns `$this`, the new map will also contain:\n\n```php\n['a' => MyClass(), 'b' => MyClass()]\n```\n\nOn those new map elements, `getCode()` will be called which returns `x` for the\nfirst object and `y` for the second. The map created from the results of `getCode()`\nwill return:\n\n```php\n['a' => 'x', 'b' => 'y']\n```\n\n\n## Methods\n\n\u003Cnav>\n\n\u003Ca href=\"#is_map-function\">function is_map\u003C\u002Fa>\n\u003Ca href=\"#map-function\">function map\u003C\u002Fa>\n\u003Ca href=\"#__construct\">__construct\u003C\u002Fa>\n\u003Ca href=\"#__call\">__call\u003C\u002Fa>\n\u003Ca href=\"#__callstatic\">__callStatic\u003C\u002Fa>\n\u003Ca href=\"#after\">after\u003C\u002Fa>\n\u003Ca href=\"#all\">all\u003C\u002Fa>\n\u003Ca href=\"#any\">any\u003C\u002Fa>\n\u003Ca href=\"#arsort\">arsort\u003C\u002Fa>\n\u003Ca href=\"#arsorted\">arsorted\u003C\u002Fa>\n\u003Ca href=\"#asort\">asort\u003C\u002Fa>\n\u003Ca href=\"#asorted\">asorted\u003C\u002Fa>\n\u003Ca href=\"#at\">at\u003C\u002Fa>\n\u003Ca href=\"#avg\">avg\u003C\u002Fa>\n\u003Ca href=\"#before\">before\u003C\u002Fa>\n\u003Ca href=\"#bool\">bool\u003C\u002Fa>\n\u003Ca href=\"#call\">call\u003C\u002Fa>\n\u003Ca href=\"#cast\">cast\u003C\u002Fa>\n\u003Ca href=\"#chunk\">chunk\u003C\u002Fa>\n\u003Ca href=\"#clear\">clear\u003C\u002Fa>\n\u003Ca href=\"#clone\">clone\u003C\u002Fa>\n\u003Ca href=\"#col\">col\u003C\u002Fa>\n\u003Ca href=\"#collapse\">collapse\u003C\u002Fa>\n\u003Ca href=\"#combine\">combine\u003C\u002Fa>\n\u003Ca href=\"#concat\">concat\u003C\u002Fa>\n\u003Ca href=\"#contains\">contains\u003C\u002Fa>\n\u003Ca href=\"#copy\">copy\u003C\u002Fa>\n\u003Ca href=\"#count\">count\u003C\u002Fa>\n\u003Ca href=\"#countby\">countBy\u003C\u002Fa>\n\u003Ca href=\"#dd\">dd\u003C\u002Fa>\n\u003Ca href=\"#delimiter\">delimiter\u003C\u002Fa>\n\u003Ca href=\"#diff\">diff\u003C\u002Fa>\n\u003Ca href=\"#diffassoc\">diffAssoc\u003C\u002Fa>\n\u003Ca href=\"#diffkeys\">diffKeys\u003C\u002Fa>\n\u003Ca href=\"#dump\">dump\u003C\u002Fa>\n\u003Ca href=\"#duplicates\">duplicates\u003C\u002Fa>\n\u003Ca href=\"#each\">each\u003C\u002Fa>\n\u003Ca href=\"#empty\">empty\u003C\u002Fa>\n\u003Ca href=\"#equals\">equals\u003C\u002Fa>\n\u003Ca href=\"#every\">every\u003C\u002Fa>\n\u003Ca href=\"#except\">except\u003C\u002Fa>\n\u003Ca href=\"#explode\">explode\u003C\u002Fa>\n\u003Ca href=\"#fill\">fill\u003C\u002Fa>\n\u003Ca href=\"#filter\">filter\u003C\u002Fa>\n\u003Ca href=\"#find\">find\u003C\u002Fa>\n\u003Ca href=\"#findkey\">findKey\u003C\u002Fa>\n\u003Ca href=\"#first\">first\u003C\u002Fa>\n\u003Ca href=\"#firstkey\">firstKey\u003C\u002Fa>\n\u003Ca href=\"#flat\">flat\u003C\u002Fa>\n\u003Ca href=\"#flatten\">flatten\u003C\u002Fa>\n\u003Ca href=\"#flip\">flip\u003C\u002Fa>\n\u003Ca href=\"#float\">float\u003C\u002Fa>\n\u003Ca href=\"#from\">from\u003C\u002Fa>\n\u003Ca href=\"#fromjson\">fromJson\u003C\u002Fa>\n\u003Ca href=\"#get\">get\u003C\u002Fa>\n\u003Ca href=\"#getiterator\">getIterator\u003C\u002Fa>\n\u003Ca href=\"#grep\">grep\u003C\u002Fa>\n\u003Ca href=\"#groupby\">groupBy\u003C\u002Fa>\n\u003Ca href=\"#has\">has\u003C\u002Fa>\n\u003Ca href=\"#if\">if\u003C\u002Fa>\n\u003Ca href=\"#ifany\">ifAny\u003C\u002Fa>\n\u003Ca href=\"#ifempty\">ifEmpty\u003C\u002Fa>\n\u003Ca href=\"#implements\">implements\u003C\u002Fa>\n\u003Ca href=\"#in\">in\u003C\u002Fa>\n\u003Ca href=\"#includes\">includes\u003C\u002Fa>\n\u003Ca href=\"#index\">index\u003C\u002Fa>\n\u003Ca href=\"#insertafter\">insertAfter\u003C\u002Fa>\n\u003Ca href=\"#insertat\">insertAt\u003C\u002Fa>\n\u003Ca href=\"#insertbefore\">insertBefore\u003C\u002Fa>\n\u003Ca href=\"#int\">int\u003C\u002Fa>\n\u003Ca href=\"#intersect\">intersect\u003C\u002Fa>\n\u003Ca href=\"#intersectassoc\">intersectAssoc\u003C\u002Fa>\n\u003Ca href=\"#intersectkeys\">intersectKeys\u003C\u002Fa>\n\u003Ca href=\"#is\">is\u003C\u002Fa>\n\u003Ca href=\"#isempty\">isEmpty\u003C\u002Fa>\n\u003Ca href=\"#islist\">isList\u003C\u002Fa>\n\u003Ca href=\"#isobject\">isObject\u003C\u002Fa>\n\u003Ca href=\"#isnumeric\">isNumeric\u003C\u002Fa>\n\u003Ca href=\"#isscalar\">isScalar\u003C\u002Fa>\n\u003Ca href=\"#issole\">isSole\u003C\u002Fa>\n\u003Ca href=\"#isstring\">isString\u003C\u002Fa>\n\u003Ca href=\"#join\">join\u003C\u002Fa>\n\u003Ca href=\"#jsonserialize\">jsonSerialize\u003C\u002Fa>\n\u003Ca href=\"#keys\">keys\u003C\u002Fa>\n\u003Ca href=\"#krsort\">krsort\u003C\u002Fa>\n\u003Ca href=\"#krsorted\">krsorted\u003C\u002Fa>\n\u003Ca href=\"#ksort\">ksort\u003C\u002Fa>\n\u003Ca href=\"#ksorted\">ksorted\u003C\u002Fa>\n\u003Ca href=\"#last\">last\u003C\u002Fa>\n\u003Ca href=\"#lastkey\">lastKey\u003C\u002Fa>\n\u003Ca href=\"#ltrim\">ltrim\u003C\u002Fa>\n\u003Ca href=\"#map\">map\u003C\u002Fa>\n\u003Ca href=\"#max\">max\u003C\u002Fa>\n\u003Ca href=\"#merge\">merge\u003C\u002Fa>\n\u003Ca href=\"#method\">method\u003C\u002Fa>\n\u003Ca href=\"#min\">min\u003C\u002Fa>\n\u003Ca href=\"#none\">none\u003C\u002Fa>\n\u003Ca href=\"#nth\">nth\u003C\u002Fa>\n\u003Ca href=\"#offsetexists\">offsetExists\u003C\u002Fa>\n\u003Ca href=\"#offsetget\">offsetGet\u003C\u002Fa>\n\u003Ca href=\"#offsetset\">offsetSet\u003C\u002Fa>\n\u003Ca href=\"#offsetunset\">offsetUnset\u003C\u002Fa>\n\u003Ca href=\"#only\">only\u003C\u002Fa>\n\u003Ca href=\"#order\">order\u003C\u002Fa>\n\u003Ca href=\"#pad\">pad\u003C\u002Fa>\n\u003Ca href=\"#partition\">partition\u003C\u002Fa>\n\u003Ca href=\"#percentage\">percentage\u003C\u002Fa>\n\u003Ca href=\"#pipe\">pipe\u003C\u002Fa>\n\u003Ca href=\"#pluck\">pluck\u003C\u002Fa>\n\u003Ca href=\"#pop\">pop\u003C\u002Fa>\n\u003Ca href=\"#pos\">pos\u003C\u002Fa>\n\u003Ca href=\"#prefix\">prefix\u003C\u002Fa>\n\u003Ca href=\"#prepend\">prepend\u003C\u002Fa>\n\u003Ca href=\"#pull\">pull\u003C\u002Fa>\n\u003Ca href=\"#push\">push\u003C\u002Fa>\n\u003Ca href=\"#put\">put\u003C\u002Fa>\n\u003Ca href=\"#random\">random\u003C\u002Fa>\n\u003Ca href=\"#reduce\">reduce\u003C\u002Fa>\n\u003Ca href=\"#reject\">reject\u003C\u002Fa>\n\u003Ca href=\"#rekey\">rekey\u003C\u002Fa>\n\u003Ca href=\"#remove\">remove\u003C\u002Fa>\n\u003Ca href=\"#replace\">replace\u003C\u002Fa>\n\u003Ca href=\"#restrict\">restrict\u003C\u002Fa>\n\u003Ca href=\"#reverse\">reverse\u003C\u002Fa>\n\u003Ca href=\"#reversed\">reversed\u003C\u002Fa>\n\u003Ca href=\"#rsort\">rsort\u003C\u002Fa>\n\u003Ca href=\"#rsorted\">rsorted\u003C\u002Fa>\n\u003Ca href=\"#rtrim\">rtrim\u003C\u002Fa>\n\u003Ca href=\"#search\">search\u003C\u002Fa>\n\u003Ca href=\"#sep\">sep\u003C\u002Fa>\n\u003Ca href=\"#set\">set\u003C\u002Fa>\n\u003Ca href=\"#shift\">shift\u003C\u002Fa>\n\u003Ca href=\"#shuffle\">shuffle\u003C\u002Fa>\n\u003Ca href=\"#shuffled\">shuffled\u003C\u002Fa>\n\u003Ca href=\"#skip\">skip\u003C\u002Fa>\n\u003Ca href=\"#slice\">slice\u003C\u002Fa>\n\u003Ca href=\"#sliding\">sliding\u003C\u002Fa>\n\u003Ca href=\"#sole\">sole\u003C\u002Fa>\n\u003Ca href=\"#some\">some\u003C\u002Fa>\n\u003Ca href=\"#sort\">sort\u003C\u002Fa>\n\u003Ca href=\"#sorted\">sorted\u003C\u002Fa>\n\u003Ca href=\"#splice\">splice\u003C\u002Fa>\n\u003Ca href=\"#strafter\">strAfter\u003C\u002Fa>\n\u003Ca href=\"#strbefore\">strBefore\u003C\u002Fa>\n\u003Ca href=\"#strcompare\">strCompare\u003C\u002Fa>\n\u003Ca href=\"#strcontains\">strContains\u003C\u002Fa>\n\u003Ca href=\"#strcontainsall\">strContainsAll\u003C\u002Fa>\n\u003Ca href=\"#strends\">strEnds\u003C\u002Fa>\n\u003Ca href=\"#strendsall\">strEndsAll\u003C\u002Fa>\n\u003Ca href=\"#string\">string\u003C\u002Fa>\n\u003Ca href=\"#strlower\">strLower\u003C\u002Fa>\n\u003Ca href=\"#strreplace\">strReplace\u003C\u002Fa>\n\u003Ca href=\"#strstarts\">strStarts\u003C\u002Fa>\n\u003Ca href=\"#strstartsall\">strStartsAll\u003C\u002Fa>\n\u003Ca href=\"#strupper\">strUpper\u003C\u002Fa>\n\u003Ca href=\"#suffix\">suffix\u003C\u002Fa>\n\u003Ca href=\"#sum\">sum\u003C\u002Fa>\n\u003Ca href=\"#take\">take\u003C\u002Fa>\n\u003Ca href=\"#tap\">tap\u003C\u002Fa>\n\u003Ca href=\"#times\">times\u003C\u002Fa>\n\u003Ca href=\"#to\">to\u003C\u002Fa>\n\u003Ca href=\"#toarray\">toArray\u003C\u002Fa>\n\u003Ca href=\"#tojson\">toJson\u003C\u002Fa>\n\u003Ca href=\"#toreversed\">toReversed\u003C\u002Fa>\n\u003Ca href=\"#tosorted\">toSorted\u003C\u002Fa>\n\u003Ca href=\"#tourl\">toUrl\u003C\u002Fa>\n\u003Ca href=\"#transform\">transform\u003C\u002Fa>\n\u003Ca href=\"#transpose\">transpose\u003C\u002Fa>\n\u003Ca href=\"#traverse\">traverse\u003C\u002Fa>\n\u003Ca href=\"#tree\">tree\u003C\u002Fa>\n\u003Ca href=\"#trim\">trim\u003C\u002Fa>\n\u003Ca href=\"#uasort\">uasort\u003C\u002Fa>\n\u003Ca href=\"#uasorted\">uasorted\u003C\u002Fa>\n\u003Ca href=\"#uksort\">uksort\u003C\u002Fa>\n\u003Ca href=\"#uksorted\">uksorted\u003C\u002Fa>\n\u003Ca href=\"#unflatten\">unflatten\u003C\u002Fa>\n\u003Ca href=\"#union\">union\u003C\u002Fa>\n\u003Ca href=\"#unique\">unique\u003C\u002Fa>\n\u003Ca href=\"#unshift\">unshift\u003C\u002Fa>\n\u003Ca href=\"#usort\">usort\u003C\u002Fa>\n\u003Ca href=\"#usorted\">usorted\u003C\u002Fa>\n\u003Ca href=\"#values\">values\u003C\u002Fa>\n\u003Ca href=\"#walk\">walk\u003C\u002Fa>\n\u003Ca href=\"#where\">where\u003C\u002Fa>\n\u003Ca href=\"#with\">with\u003C\u002Fa>\n\u003Ca href=\"#zip\">zip\u003C\u002Fa>\n\n\u003C\u002Fnav>\n\n### Create\n\n* [function map()](#map-function) : Creates a new map from passed elements\n* [__construct()](#__construct) : Creates a new map\n* [clone()](#clone) : Clones the map and all objects within\n* [copy()](#copy) : Creates a new copy\n* [explode()](#explode) : Splits a string into a map of elements\n* [fill()](#fill) : Creates a new map filled with given value\n* [from()](#from) : Creates a new map from passed elements\n* [fromJson()](#fromjson) : Creates a new map from a JSON string\n* [times()](#times) : Creates a new map by invoking the closure a number of times\n* [tree()](#tree) : Creates a tree structure from the list items\n\n### Access\n\n* [__call()](#__call) : Calls a custom method\n* [__callStatic()](#__callstatic) : Calls a custom method statically\n* [all()](#all) : Returns the plain array\n* [any()](#any) : Tests if at least one element satisfies the callback function\n* [at()](#at) : Returns the value at the given position\n* [bool()](#bool) : Returns an element by key and casts it to boolean\n* [call()](#call) : Calls the given method on all items\n* [find()](#find) : Returns the first\u002Flast element where the callback returns TRUE\n* [findKey()](#findkey) : Returns the first\u002Flast key where the callback returns TRUE\n* [first()](#first) : Returns the first element\n* [firstKey()](#firstkey) : Returns the first key\n* [get()](#get) : Returns an element by key\n* [index()](#index) : Returns the numerical index of the given key\n* [int()](#int) : Returns an element by key and casts it to integer\n* [float()](#float) : Returns an element by key and casts it to float\n* [keys()](#keys) : Returns all keys\n* [last()](#last) : Returns the last element\n* [lastKey()](#lastkey) : Returns the last key\n* [pop()](#pop) : Returns and removes the last element\n* [pos()](#pos) : Returns the numerical index of the value\n* [pull()](#pull) : Returns and removes an element by key\n* [random()](#random) : Returns random elements preserving keys\n* [search()](#search) : Find the key of an element\n* [shift()](#shift) : Returns and removes the first element\n* [sole()](#sole) : Returns the matching item if it's the only one\n* [string()](#string) : Returns an element by key and casts it to string\n* [to()](#to) : Returns the plain array\n* [toArray()](#toarray) : Returns the plain array\n* [values()](#values) : Returns all elements with new keys\n\n### Add\n\n* [concat()](#concat) : Adds all elements with new keys\n* [insertAfter()](#insertafter) : Inserts the value after the given element\n* [insertAt()](#insertat) : Inserts the element at the given position in the map\n* [insertBefore()](#insertbefore) : Inserts the value before the given element\n* [merge()](#merge) : Combines elements overwriting existing ones\n* [pad()](#pad) : Fill up to the specified length with the given value\n* [prepend()](#prepend) : Adds an element at the beginning (alias)\n* [push()](#push) : Adds an element to the end\n* [put()](#put) : Sets the given key and value in the map (alias)\n* [set()](#set) : Overwrites or adds an element\n* [union()](#union) : Adds the elements without overwriting existing ones\n* [unshift()](#unshift) : Adds an element at the beginning\n* [with()](#with) : Returns a copy and sets an element\n\n### Aggregate\n\n* [avg()](#avg) : Returns the average of all values\n* [count()](#count) : Returns the total number of elements\n* [countBy()](#countby) : Counts how often the same values are in the map\n* [max()](#max) : Returns the maximum value of all elements\n* [min()](#min) : Returns the minium value of all elements\n* [percentage()](#percentage) : Returns the percentage of all elements passing the test\n* [sum()](#sum) : Returns the sum of all values in the map\n\n### Debug\n\n* [dd()](#dd) : Prints the map content and terminates the script\n* [dump()](#dump) : Prints the map content\n* [tap()](#tap) : Passes a clone of the map to the given callback\n\n### Order By\n\n* [arsort()](#arsort) : Reverse sort elements preserving keys\n* [arsorted()](#arsorted) : Reverse sort elements preserving keys in a copy of the map\n* [asort()](#asort) : Sort elements preserving keys\n* [asorted()](#asorted) : Sort elements preserving keys in a copy of the map\n* [krsort()](#krsort) : Reverse sort elements by keys\n* [krsorted()](#krsorted) : Reverse sort elements by keys in a copy of the map\n* [ksort()](#ksort) : Sort elements by keys\n* [ksorted()](#ksorted) : Sorts a copy of the elements by their keys\n* [order()](#order) : Orders elements by the passed keys\n* [reverse()](#reverse) : Reverses the array order preserving keys\n* [reversed()](#reversed) : Reverses the element order in a copy of the map\n* [toReversed()](#toreversed) : Reverses the element order in a copy of the map (alias)\n* [rsort()](#rsort) : Reverse sort elements using new keys\n* [rsorted()](#rsorted) : Reverse sort elements using new keys in a copy of the map\n* [shuffle()](#shuffle) : Randomizes the element order\n* [shuffled()](#shuffled) : Randomizes the element order in a copy of the map\n* [sort()](#sort) : Sorts the elements in-place assigning new keys\n* [sorted()](#sorted) : Sorts the elements in a copy of the map using new keys\n* [toSorted()](#tosorted) : Sorts the elements in a copy of the map using new keys (alias)\n* [uasort()](#uasort) : Sorts elements preserving keys using callback\n* [uasorted()](#uasorted) : Sorts elements preserving keys using callback in a copy of the map\n* [uksort()](#uksort) : Sorts elements by keys using callback\n* [uksorted()](#uksorted) : Sorts elements by keys using callback in a copy of the map\n* [usort()](#usort) : Sorts elements using callback assigning new keys\n* [usorted()](#usorted) : Sorts elements using callback assigning new keys in a copy of the map\n\n### Shorten\n\n* [after()](#after) : Returns the elements after the given one\n* [before()](#before) : Returns the elements before the given one\n* [clear()](#clear) : Removes all elements\n* [diff()](#diff) : Returns the elements missing in the given list\n* [diffAssoc()](#diffassoc) : Returns the elements missing in the given list and checks keys\n* [diffKeys()](#diffkeys) : Returns the elements missing in the given list by keys\n* [duplicates()](#duplicates) : Returns the duplicate values from the map\n* [except()](#except) : Returns a new map without the passed element keys\n* [filter()](#filter) : Applies a filter to all elements\n* [grep()](#grep) : Applies a regular expression to all elements\n* [intersect()](#intersect) : Returns the elements shared\n* [intersectAssoc()](#intersectassoc) : Returns the elements shared and checks keys\n* [intersectKeys()](#intersectkeys) : Returns the elements shared by keys\n* [nth()](#nth) : Returns every nth element from the map\n* [only()](#only) : Returns only those elements specified by the keys\n* [pop()](#pop) : Returns and removes the last element\n* [pull()](#pull) : Returns and removes an element by key\n* [reject()](#reject) : Removes all matched elements\n* [remove()](#remove) : Removes an element by key\n* [restrict()](#restrict) : Returns only the items matching the value (and key)\n* [shift()](#shift) : Returns and removes the first element\n* [skip()](#skip) : Skips the given number of items and return the rest\n* [slice()](#slice) : Returns a slice of the map\n* [take()](#take) : Returns a new map with the given number of items\n* [unique()](#unique) : Returns all unique elements preserving keys\n* [where()](#where) : Filters the list of elements by a given condition\n\n### Test\n\n* [function is_map()](#is_map-function) : Tests if the variable is a map object\n* [any()](#any) : Tests if at least one element satisfies the callback function\n* [contains()](#contains) : Tests if an item exists in the map\n* [each()](#each) : Applies a callback to each element\n* [empty()](#empty) : Tests if map is empty\n* [equals()](#equals) : Tests if map contents are equal\n* [every()](#every) : Verifies that all elements pass the test of the given callback\n* [has()](#has) : Tests if a key exists\n* [if()](#if) : Executes callbacks depending on the condition\n* [ifAny()](#ifany) : Executes callbacks if the map contains elements\n* [ifEmpty()](#ifempty) : Executes callbacks if the map is empty\n* [in()](#in) : Tests if element is included\n* [includes()](#includes) : Tests if element is included\n* [is()](#is) : Tests if the map consists of the same keys and values\n* [isEmpty()](#isempty) : Tests if map is empty\n* [isList()](#islist) : Checks if the map contains a list of subsequentially numbered keys\n* [isNumeric()](#isnumeric) : Tests if all entries are numeric values\n* [isObject()](#isobject) : Tests if all entries are objects\n* [isScalar()](#isscalar) : Tests if all entries are scalar values.\n* [isSole()](#issole) : Returns only true if exactly one item is matching.\n* [isString()](#isstring) : Tests if all entries are string values.\n* [implements()](#implements) : Tests if all entries are objects implementing the interface\n* [none()](#none) : Tests if none of the elements are part of the map\n* [some()](#some) : Tests if at least one element is included\n* [strCompare()](#strcompare) : Compares the value against all map elements\n* [strContains()](#strcontains) : Tests if at least one of the passed strings is part of at least one entry\n* [strContainsAll()](#strcontainsall) : Tests if all of the entries contains one of the passed strings\n* [strEnds()](#strends) : Tests if at least one of the entries ends with one of the passed strings\n* [strEndsAll()](#strendsall) : Tests if all of the entries ends with at least one of the passed strings\n* [strStarts()](#strstarts) : Tests if at least one of the entries starts with at least one of the passed strings\n* [strStartsAll()](#strstartsall) : Tests if all of the entries start with one of the passed strings\n\n### Mutate\n\n* [cast()](#cast) : Casts all entries to the passed type\n* [chunk()](#chunk) : Splits the map into chunks\n* [col()](#col) : Creates a key\u002Fvalue mapping\n* [collapse()](#collapse) : Collapses multi-dimensional elements overwriting elements\n* [combine()](#combine) : Combines the map elements as keys with the given values\n* [flat()](#flat) : Flattens multi-dimensional elements without overwriting elements\n* [flatten()](#flatten) : Creates a new map with keys joined recursively\n* [flip()](#flip) : Exchanges keys with their values\n* [groupBy()](#groupby) : Groups associative array elements or objects\n* [join()](#join) : Returns concatenated elements as string with separator\n* [ltrim()](#ltrim) : Removes the passed characters from the left of all strings\n* [map()](#map) : Applies a callback to each element and returns the results\n* [partition()](#partition) : Breaks the list into the given number of groups\n* [pipe()](#pipe) : Applies a callback to the whole map\n* [pluck()](#pluck) : Creates a key\u002Fvalue mapping (alias)\n* [prefix()](#prefix) : Adds a prefix to each map entry\n* [reduce()](#reduce) : Computes a single value from the map content\n* [rekey()](#rekey) : Changes the keys according to the passed function\n* [replace()](#replace) : Replaces elements recursively\n* [rtrim()](#rtrim) : Removes the passed characters from the right of all strings\n* [sliding()](#sliding) : Returns a new map containing sliding windows of the original map\n* [splice()](#splice) : Replaces a slice by new elements\n* [strAfter()](#strafter) : Returns the strings after the passed value\n* [strBefore()](#strbefore) : Returns the strings before the passed value\n* [strLower()](#strlower) : Converts all alphabetic characters to lower case\n* [strReplace()](#strreplace) : Replaces all occurrences of the search string with the replacement string\n* [strUpper()](#strupper) : Converts all alphabetic characters to upper case\n* [suffix()](#suffix) : Adds a suffix to each map entry\n* [toJson()](#tojson) : Returns the elements in JSON format\n* [toUrl()](#tourl) : Creates a HTTP query string\n* [transform()](#transform) : Applies a callback to each element which creates new key\u002Fvalue pairs\n* [transpose()](#transpose) : Exchanges rows and columns for a two dimensional map\n* [traverse()](#traverse) : Traverses trees of nested items passing each item to the callback\n* [trim()](#trim) : Removes the passed characters from the left\u002Fright of all strings\n* [unflatten()](#unflatten) : Unflattens the key path\u002Fvalue pairs into a multi-dimensional array\n* [walk()](#walk) : Applies the given callback to all elements\n* [zip()](#zip) : Merges the values of all arrays at the corresponding index\n\n### Misc\n\n* [delimiter()](#delimiter) : Sets or returns the separator for paths to multi-dimensional arrays\n* [getIterator()](#getiterator) : Returns an iterator for the elements\n* [jsonSerialize()](#jsonserialize) : Specifies the data which should be serialized to JSON\n* [method()](#method) : Registers a custom method\n* [offsetExists()](#offsetexists) : Checks if the key exists\n* [offsetGet()](#offsetget) : Returns an element by key\n* [offsetSet()](#offsetset) : Overwrites an element\n* [offsetUnset()](#offsetunset) : Removes an element by key\n* [sep()](#sep) : Sets the separator for paths to multi-dimensional arrays in the current map\n\n\n\n## Method documentation\n\n### is_map() function\n\nTests if the variable is a map object\n\n```php\nfunction is_map( mixed $var ) : bool\n```\n\n* @param **mixed** `$var` Variable to test\n\n**Examples:**\n\n```php\nis_map( new Map() );\n\u002F\u002F true\n\nis_map( [] );\n\u002F\u002F false\n```\n\n\n### map() function\n\nReturns a new map for the passed elements.\n\n```php\nfunction map( mixed $items = [] ) : \\Aimeos\\Map\n```\n\n* @param **mixed** `$items` List of elements or single value\n* @return **\\Aimeos\\Map&#60;int&#124;string,mixed&#62;** Map instance\n\n**Examples:**\n\n```php\n\u002F\u002F array\nmap( [] );\n\n\u002F\u002F null\nmap( null );\n\n\u002F\u002F scalar\nmap( 'a' );\n\n\u002F\u002F object\nmap( new \\stdClass() );\n\n\u002F\u002F map object\nmap( new Map() );\n\n\u002F\u002F iterable object\nmap( new ArrayObject() );\n\n\u002F\u002F closure evaluated lazily\nmap( function() {\n    return [];\n} );\n```\n\n**See also:**\n\n* [rekey()](#rekey) - Changes the keys according to the passed function\n* [transform()](#transform) - Creates new key\u002Fvalue pairs using the passed function and returns a new map for the result\n\n\n### __construct()\n\nCreates a new map object.\n\n```php\npublic function __construct( mixed $elements = [] )\n```\n\n* @param **mixed** `$elements` Single element, list of elements, Map object, iterable objects or iterators, everything else\n\n**Examples:**\n\n```php\n\u002F\u002F array\nnew Map( [] );\n\n\u002F\u002F null\nnew Map( null );\n\n\u002F\u002F scalar\nnew Map( 'a' );\n\n\u002F\u002F object\nnew Map( new \\stdClass() );\n\n\u002F\u002F map object\nnew Map( new Map() );\n\n\u002F\u002F iterable object\nnew Map( new ArrayObject() );\n\n\u002F\u002F closure evaluated lazily\nnew Map( function() {\n    return [];\n} );\n```\n\n\n### __call()\n\nHandles dynamic calls to custom methods for the class.\n\n```php\npublic function __call( string $name, array $params ) : mixed\n```\n\n* @param **string** `$name` Method name\n* @param **array&#60;mixed&#62;** `$params` List of parameters\n* @return **mixed** Result from called function or new map with results from the element methods\n\nCalls a custom method added by [Map::method()](#method). The called method\nhas access to the internal array by using `$this->list()`.\n\n**Examples:**\n\n```php\nMap::method( 'case', function( $case = CASE_LOWER ) {\n    return new static( array_change_key_case( $this->list(), $case ) );\n} );\n\nMap::from( ['a' => 'bar'] )->case( CASE_UPPER );\n\u002F\u002F ['A' => 'bar']\n```\n\nThis does also allow calling object methods if the items are objects:\n\n```php\n$item = new MyClass(); \u002F\u002F with method setId() (returning $this) and getCode() implemented\nMap::from( [$item, $item] )->setId( null )->getCode()->toArray();\n```\n\nThis will call the `setId()` method of each element in the map and\nuse their return values to create a new map. On the new map, the `getCode()`\nmethod is called for every element and its return values are also stored in a new\nmap. This last map is then returned and the map keys from the original map are\npreserved in the returned map.\n\nIf the elements are not objects, they are skipped and if this applies to all\nelements, an empty map is returned. In case the map contains objects of mixed\ntypes and one of them doesn't implement the called method, an error will be thrown.\n\n**See also:**\n\n* [__callStatic()](#__callStatic) - Handles static calls to custom methods for the class\n* [call()](#call) - Calls the given method on all items and returns the result\n\n\n### __callStatic()\n\nHandles static calls to custom methods for the class.\n\n```php\npublic static function __callStatic( string $name, array $params ) : mixed\n```\n\n* @param **string** `$name` Method name\n* @param **array&#60;mixed&#62;** `$params` List of parameters\n* @return **mixed** Result from called function or new map with results from the element methods\n* @throws **\\BadMethodCallException** If no method has been registered for that name\n\nCalls a custom method added by [Map::method()](#method) statically. The called method\nhas no access to the internal array because no object is available.\n\n**Examples:**\n\n```php\nMap::method( 'foo', function( $arg1, $arg2 ) {} );\nMap::foo( $arg1, $arg2 );\n```\n\n**See also:**\n\n* [__call()](#__call) - Handles dynamic calls to custom methods for the class\n* [call()](#call) - Calls the given method on all items and returns the result\n\n\n### after()\n\nReturns the elements after the given one.\n\n```php\npublic function after( \\Closure|int|string $value ) : self\n```\n\n* @param **\\Closure&#124;int&#124;string** `$value` Value or function with (item, key) parameters\n* @return **self&#60;int&#124;string,mixed&#62;** New map with the elements after the given one\n\nThe keys are preserved using this method.\n\n**Examples:**\n\n```php\nMap::from( [0 => 'b', 1 => 'a'] )->after( 'b' );\n\u002F\u002F [1 => 'a']\n\nMap::from( ['a' => 1, 'b' => 0] )->after( 1 );\n\u002F\u002F ['b' => 0]\n\nMap::from( [0 => 'b', 1 => 'a'] )->after( 'c' );\n\u002F\u002F []\n\nMap::from( ['a', 'c', 'b'] )->after( function( $item, $key ) {\n    return $item >= 'c';\n} );\n\u002F\u002F [2 => 'b']\n```\n\n**See also:**\n\n* [before()](#before) - Returns the elements before the given one\n\n\n### all()\n\nReturns the elements as a plain array.\n\n```php\npublic function all() : array\n```\n\n* @return **array** Plain array\n\n**Examples:**\n\n```php\nMap::from( ['a'] )->all();\n\u002F\u002F ['a']\n```\n\nThis method is for compatibility to Laravel Collections. Use [`to()`](#to) instead if possible.\n\n**See also:**\n\n* [to()](#to) - Returns the elements as a plain array\n* [toArray()](#toarray) - Returns the elements as a plain array\n\n\n### any()\n\nTests if at least one element satisfies the callback function.\n\n```php\npublic function any( \\Closure $callback ) : bool\n```\n\n* @param **\\Closure** `$callback` Anonymous function with (item, key) parameter\n* @return **bool** TRUE if at least one element satisfies the callback function, FALSE if not\n\n**Examples:**\n\n```php\nMap::from( ['a', 'b'] )->any( function( $item, $key ) {\n    return $item === 'a';\n} );\n\u002F\u002F TRUE\n\nMap::from( ['a', 'b'] )->any( function( $item, $key ) {\n    return !is_string( $item );\n} );\n\u002F\u002F FALSE\n```\n\n**See also:**\n\n* [some()](#some) - Tests if at least one element passes the test or is part of the map\n* [every()](#every) - Verifies that all elements pass the test of the given callback\n\n\n### arsort()\n\nSorts all elements in reverse order and maintains the key association.\n\n```php\npublic function arsort( int $options = SORT_REGULAR ) : self\n```\n\n* @param **int** `$options` Sort options for `arsort()`\n* @return **self&#60;int&#124;string,mixed&#62;** Updated map for fluid interface\n\nThe keys are preserved using this method and no new map is created.\n\nThe `$options` parameter modifies how the values are compared. Possible parameter values are:\n- SORT_REGULAR : compare elements normally (don't change types)\n- SORT_NUMERIC : compare elements numerically\n- SORT_STRING : compare elements as strings\n- SORT_LOCALE_STRING : compare elements as strings, based on the current locale or changed by `setlocale()`\n- SORT_NATURAL : compare elements as strings using \"natural ordering\" like `natsort()`\n- SORT_FLAG_CASE : use SORT_STRING&#124;SORT_FLAG_CASE and SORT_NATURAL&#124;SORT_FLAG_CASE to sort strings case-insensitively\n\n**Examples:**\n\n```php\nMap::from( ['b' => 0, 'a' => 1] )->arsort();\n\u002F\u002F ['a' => 1, 'b' => 0]\n\nMap::from( ['a', 'b'] )->arsort();\n\u002F\u002F ['b', 'a']\n\nMap::from( [0 => 'C', 1 => 'b'] )->arsort();\n\u002F\u002F [1 => 'b', 0 => 'C']\n\nMap::from( [0 => 'C', 1 => 'b'] )->arsort( SORT_STRING|SORT_FLAG_CASE );\n\u002F\u002F [0 => 'C', 1 => 'b'] because 'C' -> 'c' and 'c' > 'b'\n```\n\n**See also:**\n\n* [arsorted()](#arsorted) - Sorts a copy of all elements in reverse order and maintains the key association\n\n\n### arsorted()\n\nSorts a copy of all elements in reverse order and maintains the key association.\n\n```php\npublic function arsorted( int $options = SORT_REGULAR ) : self\n```\n\n* @param **int** `$options` Sort options for `arsort()`\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\nThe keys are preserved using this method and a new map is created.\n\nThe `$options` parameter modifies how the values are compared. Possible parameter values are:\n- SORT_REGULAR : compare elements normally (don't change types)\n- SORT_NUMERIC : compare elements numerically\n- SORT_STRING : compare elements as strings\n- SORT_LOCALE_STRING : compare elements as strings, based on the current locale or changed by `setlocale()`\n- SORT_NATURAL : compare elements as strings using \"natural ordering\" like `natsort()`\n- SORT_FLAG_CASE : use SORT_STRING&#124;SORT_FLAG_CASE and SORT_NATURAL&#124;SORT_FLAG_CASE to sort strings case-insensitively\n\n**Examples:**\n\n```php\nMap::from( ['b' => 0, 'a' => 1] )->arsorted();\n\u002F\u002F ['a' => 1, 'b' => 0]\n\nMap::from( ['a', 'b'] )->arsorted();\n\u002F\u002F ['b', 'a']\n\nMap::from( [0 => 'C', 1 => 'b'] )->arsorted();\n\u002F\u002F [1 => 'b', 0 => 'C']\n\nMap::from( [0 => 'C', 1 => 'b'] )->arsorted( SORT_STRING|SORT_FLAG_CASE );\n\u002F\u002F [0 => 'C', 1 => 'b'] because 'C' -> 'c' and 'c' > 'b'\n```\n\n**See also:**\n\n* [arsort()](#arsort) - Sorts all elements in reverse order and maintains the key association\n\n\n### asort()\n\nSorts all elements and maintains the key association.\n\n```php\npublic function asort( int $options = SORT_REGULAR ) : self\n```\n\n* @param **int** `$options` Sort options for `asort()`\n* @return **self&#60;int&#124;string,mixed&#62;** Updated map for fluid interface\n\nThe keys are preserved using this method and no new map is created.\n\nThe parameter modifies how the values are compared. Possible parameter values are:\n- SORT_REGULAR : compare elements normally (don't change types)\n- SORT_NUMERIC : compare elements numerically\n- SORT_STRING : compare elements as strings\n- SORT_LOCALE_STRING : compare elements as strings, based on the current locale or changed by `setlocale()`\n- SORT_NATURAL : compare elements as strings using \"natural ordering\" like `natsort()`\n- SORT_FLAG_CASE : use SORT_STRING&#124;SORT_FLAG_CASE and SORT_NATURAL&#124;SORT_FLAG_CASE to sort strings case-insensitively\n\n**Examples:**\n\n```php\nMap::from( ['a' => 1, 'b' => 0] )->asort();\n\u002F\u002F ['b' => 0, 'a' => 1]\n\nMap::from( [0 => 'b', 1 => 'a'] )->asort();\n\u002F\u002F [1 => 'a', 0 => 'b']\n\nMap::from( [0 => 'C', 1 => 'b'] )->asort();\n\u002F\u002F [0 => 'C', 1 => 'b'] because 'C' \u003C 'b'\n\nMap::from( [0 => 'C', 1 => 'b'] )->asort( SORT_STRING|SORT_FLAG_CASE );\n\u002F\u002F [1 => 'b', 0 => 'C'] because 'C' -> 'c' and 'c' > 'b'\n```\n\n**See also:**\n\n* [asorted()](#asorted) - Sorts a copy of all elements and maintains the key association\n\n\n### asorted()\n\nSorts a copy of all elements and maintains the key association.\n\n```php\npublic function asorted( int $options = SORT_REGULAR ) : self\n```\n\n* @param **int** `$options` Sort options for `asort()`\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\nThe keys are preserved using this method and a new map is created.\n\nThe parameter modifies how the values are compared. Possible parameter values are:\n- SORT_REGULAR : compare elements normally (don't change types)\n- SORT_NUMERIC : compare elements numerically\n- SORT_STRING : compare elements as strings\n- SORT_LOCALE_STRING : compare elements as strings, based on the current locale or changed by `setlocale()`\n- SORT_NATURAL : compare elements as strings using \"natural ordering\" like `natsort()`\n- SORT_FLAG_CASE : use SORT_STRING&#124;SORT_FLAG_CASE and SORT_NATURAL&#124;SORT_FLAG_CASE to sort strings case-insensitively\n\n**Examples:**\n\n```php\nMap::from( ['a' => 1, 'b' => 0] )->asorted();\n\u002F\u002F ['b' => 0, 'a' => 1]\n\nMap::from( [0 => 'b', 1 => 'a'] )->asorted();\n\u002F\u002F [1 => 'a', 0 => 'b']\n\nMap::from( [0 => 'C', 1 => 'b'] )->asorted();\n\u002F\u002F [0 => 'C', 1 => 'b'] because 'C' \u003C 'b'\n\nMap::from( [0 => 'C', 1 => 'b'] )->asorted( SORT_STRING|SORT_FLAG_CASE );\n\u002F\u002F [1 => 'b', 0 => 'C'] because 'C' -> 'c' and 'c' > 'b'\n```\n\n**See also:**\n\n* [asort()](#asort) - Sorts all elements and maintains the key association\n\n\n### at()\n\nReturns the value at the given position.\n\n```php\npublic function at( int $pos ) : mixed\n```\n\n* @param **int** `$pos` Position of the value in the map\n* @return **mixed** Value at the given position or NULL if no value is available\n\nThe position starts from zero and a position of \"0\" returns the first element\nof the map, \"1\" the second and so on. If the position is negative, the sequence\nwill start from the end of the map.\n\n**Examples:**\n\n```php\nMap::from( [1, 3, 5] )->at( 0 );\n\u002F\u002F 1\n\nMap::from( [1, 3, 5] )->at( 1 );\n\u002F\u002F 3\n\nMap::from( [1, 3, 5] )->at( -1 );\n\u002F\u002F 5\n\nMap::from( [1, 3, 5] )->at( 3 );\n\u002F\u002F NULL\n```\n\n**See also:**\n\n* [index()](#index) - Returns the numerical index of the given key\n* [pos()](#pos) - Returns the numerical index of the value\n\n\n### avg()\n\nReturns the average of all integer and float values in the map.\n\n```php\npublic function avg( \\Closure|string|null $col = null ) : float\n```\n\n* @param **\\Closure&#124;string&#124;null** `$col` Closure, key or path to the values in the nested array or object to compute the average for\n* @return **float** Average of all elements or 0 if there are no elements in the map\n\nNon-numeric values will be removed before calculation.\n\nThis does also work for multi-dimensional arrays by passing the keys\nof the arrays separated by the delimiter (\"\u002F\" by default), e.g. \"key1\u002Fkey2\u002Fkey3\"\nto get \"val\" from `['key1' => ['key2' => ['key3' => 'val']]]`. The same applies to\npublic properties of objects or objects implementing `__isset()` and `__get()` methods.\n\n**Examples:**\n\n```php\nMap::from( [1, 3, 5] )->avg();\n\u002F\u002F 3\n\nMap::from( [1, null, 5] )->avg();\n\u002F\u002F 3\n\nMap::from( [1, 'sum', 5] )->avg();\n\u002F\u002F 2\n\nMap::from( [['p' => 30], ['p' => 50], ['p' => 10]] )->avg( 'p' );\n\u002F\u002F 30\n\nMap::from( [['i' => ['p' => 30]], ['i' => ['p' => 50]]] )->avg( 'i\u002Fp' );\n\u002F\u002F 40\n\nMap::from( [['i' => ['p' => 30]], ['i' => ['p' => 50]]] )->avg( fn( $val, $key ) => $val['i']['p'] ?? null );\n\u002F\u002F 40\n\nMap::from( [['p' => 30], ['p' => 50], ['p' => 10]] )->avg( fn( $val, $key ) => $key \u003C 1 ? $val : null );\n\u002F\u002F 30\n```\n\n**See also:**\n\n* [count()](#count) - Returns the total number of elements\n* [max()](#max) - Returns the maximum value of all elements\n* [min()](#min) - Returns the minium value of all elements\n* [percentage()](#percentage) - Returns the percentage of all elements passing the test\n* [sum()](#sum) - Returns the sum of all values in the map\n\n\n### before()\n\nReturns the elements before the given one.\n\n```php\npublic function before( \\Closure|int|string $value ) : self\n```\n\n* @param **\\Closure&#124;int&#124;string** `$value` Value or function with (item, key) parameters\n* @return **self&#60;int&#124;string,mixed&#62;** New map with the elements before the given one\n\nThe keys are preserved using this method.\n\n**Examples:**\n\n```php\nMap::from( ['a' => 1, 'b' => 0] )->before( 0 );\n\u002F\u002F ['a' => 1]\n\nMap::from( [0 => 'b', 1 => 'a'] )->before( 'a' );\n\u002F\u002F [0 => 'b']\n\nMap::from( [0 => 'b', 1 => 'a'] )->before( 'c' );\n\u002F\u002F []\n\nMap::from( ['a', 'c', 'b'] )->before( function( $item, $key ) {\n    return $key >= 1;\n} );\n\u002F\u002F [0 => 'a']\n```\n\n**See also:**\n\n* [after()](#after) - Returns the elements after the given one\n\n\n### bool()\n\nReturns an element by key and casts it to boolean if possible.\n\n```php\npublic function bool( int|string $key, \\Closure|\\Throwable|bool $default = false ) : bool\n```\n\n* @param **int&#124;string** `$key` Key or path to the requested item\n* @param **\\Closure&#124;\\Throwable&#124;bool** `$default` Default value if key isn't found\n* @return **bool** Value from map or default value\n\nThis does also work to map values from multi-dimensional arrays by passing the keys\nof the arrays separated by the delimiter (\"\u002F\" by default), e.g. `key1\u002Fkey2\u002Fkey3`\nto get `val` from `['key1' => ['key2' => ['key3' => 'val']]]`. The same applies to\npublic properties of objects or objects implementing `__isset()` and `__get()` methods.\n\n**Examples:**\n\n```php\nMap::from( ['a' => true] )->bool( 'a' );\n\u002F\u002F true\n\nMap::from( ['a' => '1'] )->bool( 'a' );\n\u002F\u002F true (casted to boolean)\n\nMap::from( ['a' => 1.1] )->bool( 'a' );\n\u002F\u002F true (casted to boolean)\n\nMap::from( ['a' => '10'] )->bool( 'a' );\n\u002F\u002F true (casted to boolean)\n\nMap::from( ['a' => 'abc'] )->bool( 'a' );\n\u002F\u002F true (casted to boolean)\n\nMap::from( ['a' => ['b' => ['c' => true]]] )->bool( 'a\u002Fb\u002Fc' );\n\u002F\u002F true\n\nMap::from( [] )->bool( 'c', function( $val ) { return rand( 1, 2 ); } );\n\u002F\u002F true (value returned by closure is casted to boolean)\n\nMap::from( [] )->bool( 'a', true );\n\u002F\u002F true (default value used)\n\nMap::from( [] )->bool( 'a' );\n\u002F\u002F false\n\nMap::from( ['b' => ''] )->bool( 'b' );\n\u002F\u002F false (casted to boolean)\n\nMap::from( ['b' => null] )->bool( 'b' );\n\u002F\u002F false (null is not scalar)\n\nMap::from( ['b' => [true]] )->bool( 'b' );\n\u002F\u002F false (arrays are not scalar)\n\nMap::from( ['b' => resource] )->bool( 'b' );\n\u002F\u002F false (resources are not scalar)\n\nMap::from( ['b' => new \\stdClass] )->bool( 'b' );\n\u002F\u002F false (objects are not scalar)\n\nMap::from( [] )->bool( 'c', new \\Exception( 'error' ) );\n\u002F\u002F throws exception\n```\n\n**See also:**\n\n* [cast()](#cast) - Casts all entries to the passed type\n* [float()](#float) - Returns an element by key and casts it to float if possible\n* [get()](#get) - Returns an element from the map by key\n* [int()](#int) - Returns an element by key and casts it to integer if possible\n* [string()](#string) - Returns an element by key and casts it to string if possible\n\n\n### call()\n\nCalls the given method on all items and returns the result.\n\n```php\npublic function call( string $name, array $params = [] ) : self\n```\n\n* @param **string** `$name` Method name\n* @param **array&#60;mixed&#62;** `$params` List of parameters\n* @return **self&#60;int&#124;string,mixed&#62;** New map with results from all elements\n\nThis method can call methods on the map entries that are also implemented\nby the map object itself and are therefore not reachable when using the\nmagic `__call()` method. If some entries are not objects, they will be skipped.\n\nThe keys from the original map are preserved in the returned in the new map.\n\n**Examples:**\n\n```php\n$item = new MyClass( ['myprop' => 'val'] ); \u002F\u002F implements methods get() and toArray()\n\nMap::from( [$item, $item] )->call( 'get', ['myprop'] );\n\u002F\u002F ['val', 'val']\n\nMap::from( [$item, $item] )->call( 'toArray' );\n\u002F\u002F [['myprop' => 'val'], ['myprop' => 'val']]\n```\n\n**See also:**\n\n* [__call()](#__call) - Handles dynamic calls to custom methods for the class\n* [__callStatic()](#__callStatic) - Handles static calls to custom methods for the class\n\n\n### cast()\n\nCasts all entries to the passed type.\n\n```php\npublic function cast( string $type = 'string' ) : self\n```\n\n* @param **string** `$type` Type to cast the values to (\"string\", \"bool\", \"int\", \"float\", \"array\", \"object\")\n* @return **self&#60;int&#124;string,mixed&#62;** Updated map with casted elements\n\nCasting arrays and objects to scalar values won't return anything useful!\n\n**Examples:**\n\n```php\nMap::from( [true, 1, 1.0, 'yes'] )->cast();\n\u002F\u002F ['1', '1', '1.0', 'yes']\n\nMap::from( [true, 1, 1.0, 'yes'] )->cast( 'bool' );\n\u002F\u002F [true, true, true, true]\n\nMap::from( [true, 1, 1.0, 'yes'] )->cast( 'int' );\n\u002F\u002F [1, 1, 1, 0]\n\nMap::from( [true, 1, 1.0, 'yes'] )->cast( 'float' );\n\u002F\u002F [1.0, 1.0, 1.0, 0.0]\n\nMap::from( [new stdClass, new stdClass] )->cast( 'array' );\n\u002F\u002F [[], []]\n\nMap::from( [[], []] )->cast( 'object' );\n\u002F\u002F [new stdClass, new stdClass]\n```\n\n**See also:**\n\n* [bool()](#bool) - Returns an element by key and casts it to boolean if possible\n* [int()](#int) - Returns an element by key and casts it to integer if possible\n* [float()](#float) - Returns an element by key and casts it to float if possible\n* [string()](#string) - Returns an element by key and casts it to string if possible\n\n\n### chunk()\n\nChunks the map into arrays with the given number of elements.\n\n```php\npublic function chunk( int $size, bool $preserve = false ) : self\n```\n\n* @param **int** `$size` Maximum size of the sub-arrays\n* @param **bool** `$preserve` Preserve keys in new map\n* @return **self&#60;int&#124;string,mixed&#62;** New map with elements chunked in sub-arrays\n* @throws **\\InvalidArgumentException** If size is smaller than 1\n\nThe last chunk may contain less elements than the given number.\n\nThe sub-arrays of the returned map are plain PHP arrays. If you need Map\nobjects, then wrap them with [Map::from()](#from) when you iterate over the map.\n\n**Examples:**\n\n```php\nMap::from( [0, 1, 2, 3, 4] )->chunk( 3 );\n\u002F\u002F [[0, 1, 2], [3, 4]]\n\nMap::from( ['a' => 0, 'b' => 1, 'c' => 2] )->chunk( 2 );\n\u002F\u002F [['a' => 0, 'b' => 1], ['c' => 2]]\n```\n\n**See also:**\n\n* [partition()](#partition) - Breaks the list into the given number of groups\n\n\n### clear()\n\nRemoves all elements from the current map.\n\n```php\npublic function clear() : self\n```\n\n* @return **self&#60;int&#124;string,mixed&#62;** Updated map for fluid interface\n\n**Examples:**\n\n```php\nMap::from( [0, 1] )->clear();\n\u002F\u002F internal : []\n```\n\n**See also:**\n\n* [except()](#except) - Returns a new map without the passed element keys\n* [only()](#only) - Returns only those elements specified by the keys\n* [reject()](#reject) - Removes all matched elements\n* [remove()](#remove) - Removes an element by key\n\n\n### clone()\n\nClones the map and all objects within.\n\n```php\npublic function clone() : self\n```\n\n* @return **self&#60;int&#124;string,mixed&#62;** New map with cloned objects\n\nThe objects within the Map are NOT the same as before but new cloned objects.\nThis is different to [`copy()`](#copy), which doesn't clone the objects within.\n\nThe keys are preserved using this method.\n\n**Examples:**\n\n```php\nMap::from( [new \\stdClass, new \\stdClass] )->clone();\n\u002F\u002F [new \\stdClass, new \\stdClass]\n```\n\n**See also:**\n\n* [copy()](#copy) - Creates a new copy\n\n\n### col()\n\nReturns the values of a single column\u002Fproperty from an array of arrays or objects in a new map.\n\n```php\npublic function col( ?string $valuecol = null, ?string $indexcol = null ) : self\n```\n\n* @param **string&#124;null** `$valuecol` Name or path of the value property\n* @param **string&#124;null** `$indexcol` Name or path of the index property\n* @return **self&#60;int&#124;string,mixed&#62;** New map with mapped entries\n\nIf $indexcol is omitted, it's value is NULL or not set, the result will be indexed from 0-n.\nItems with the same value for $indexcol will overwrite previous items and only the last one\nwill be part of the resulting map.\n\nThis does also work to map values from multi-dimensional arrays by passing the keys\nof the arrays separated by the delimiter (\"\u002F\" by default), e.g. `key1\u002Fkey2\u002Fkey3`\nto get `val` from `['key1' => ['key2' => ['key3' => 'val']]]`. The same applies to\npublic properties of objects or objects implementing `__isset()` and `__get()` methods.\n\n**Examples:**\n\n```php\nMap::from( [['id' => 'i1', 'val' => 'v1'], ['id' => 'i2', 'val' => 'v2']] )->col( 'val' );\n\u002F\u002F ['v1', 'v2']\n\nMap::from( [['id' => 'i1', 'val' => 'v1'], ['id' => 'i2', 'val' => 'v2']] )->col( 'val', 'id' );\n\u002F\u002F ['i1' => 'v1', 'i2' => 'v2']\n\nMap::from( [['id' => 'i1', 'val' => 'v1'], ['id' => 'i2', 'val' => 'v2']] )->col( null, 'id' );\n\u002F\u002F ['i1' => ['id' => 'i1', 'val' => 'v1'], 'i2' => ['id' => 'i2', 'val' => 'v2']]\n\nMap::from( [['id' => 'ix', 'val' => 'v1'], ['id' => 'ix', 'val' => 'v2']] )->col( null, 'id' );\n\u002F\u002F ['ix' => ['id' => 'ix', 'val' => 'v2']]\n\nMap::from( [['foo' => ['bar' => 'one', 'baz' => 'two']]] )->col( 'foo\u002Fbaz', 'foo\u002Fbar' );\n\u002F\u002F ['one' => 'two']\n\nMap::from( [['foo' => ['bar' => 'one']]] )->col( 'foo\u002Fbaz', 'foo\u002Fbar' );\n\u002F\u002F ['one' => null]\n\nMap::from( [['foo' => ['baz' => 'two']]] )->col( 'foo\u002Fbaz', 'foo\u002Fbar' );\n\u002F\u002F ['two']\n```\n\n**See also:**\n\n* [map()](#map) - Applies a callback to each element and returns the results\n* [pluck()](#pluck) - Creates a key\u002Fvalue mapping (alias)\n* [rekey()](#pluck) - Changes the keys according to the passed function\n\n\n### collapse()\n\nCollapses all sub-array elements recursively to a new map.\n\n```php\npublic function collapse( ?int $depth = null ) : self\n```\n\n* @param **int&#124;null** `$depth` Number of levels to collapse for multi-dimensional arrays or NULL for all\n* @return **self&#60;int&#124;string,mixed&#62;** New map with all sub-array elements added into it recursively, up to the specified depth\n\nThe keys are preserved and already existing elements will be overwritten. This\nis also true for numeric keys! This method is similar than [flat()](#flat) but replaces\nalready existing elements.\n\nA value smaller than 1 for depth will return the same map elements. Collapsing\ndoes also work if elements implement the \"Traversable\" interface (which the Map\nobject does).\n\n**Examples:**\n\n```php\nMap::from( [0 => ['a' => 0, 'b' => 1], 1 => ['c' => 2, 'd' => 3]] )->collapse();\n\u002F\u002F ['a' => 0, 'b' => 1, 'c' => 2, 'd' => 3]\n\nMap::from( [0 => ['a' => 0, 'b' => 1], 1 => ['a' => 2]] )->collapse();\n\u002F\u002F ['a' => 2, 'b' => 1]\n\nMap::from( [0 => [0 => 0, 1 => 1], 1 => [0 => ['a' => 2, 0 => 3], 1 => 4]] )->collapse();\n\u002F\u002F [0 => 3, 1 => 4, 'a' => 2]\n\nMap::from( [0 => [0 => 0, 'a' => 1], 1 => [0 => ['b' => 2, 0 => 3], 1 => 4]] )->collapse( 1 );\n\u002F\u002F [0 => ['b' => 2, 0 => 3], 1 => 4, 'a' => 1]\n\nMap::from( [0 => [0 => 0, 'a' => 1], 1 => Map::from( [0 => ['b' => 2, 0 => 3], 1 => 4] )] )->collapse();\n\u002F\u002F [0 => 3, 'a' => 1, 'b' => 2, 1 => 4]\n```\n\n**See also:**\n\n* [flat()](#flat) - Flattens multi-dimensional elements without overwriting elements\n\n\n### combine()\n\nCombines the values of the map as keys with the passed elements as values.\n\n```php\npublic function combine( iterable $values ) : self\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$values` Values of the new map\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\n**Examples:**\n\n```php\nMap::from( ['name', 'age'] )->combine( ['Tom', 29] );\n\u002F\u002F ['name' => 'Tom', 'age' => 29]\n```\n\n**See also:**\n\n* [zip()](#zip) - Merges the values of all arrays at the corresponding index\n\n\n### concat()\n\nPushs all of the given elements onto the map with new keys without creating a new map.\n\n```php\npublic function concat( iterable $elements ) : self\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$elements` List of elements\n* @return **self&#60;int&#124;string,mixed&#62;** Updated map for fluid interface\n\nThe keys of the passed elements are NOT preserved!\n\n**Examples:**\n\n```php\nMap::from( ['foo'] )->concat( ['bar'] );\n\u002F\u002F ['foo', 'bar']\n\nMap::from( ['foo'] )->concat( new Map( ['bar' => 'baz'] ) );\n\u002F\u002F ['foo', 'baz']\n```\n\n**See also:**\n\n* [merge()](#merge) - Merges the map with the given elements without returning a new map\n* [union()](#union) - Builds a union of the elements and the given elements without returning a new map\n\n\n### contains()\n\nDetermines if an item exists in the map.\n\n```php\npublic function contains( \\Closure|iterable|string|int $key, ?string $operator = null, mixed $value = null ) : bool\n```\n\nThis method combines the power of the `where()` method with `some()` to check\nif the map contains at least one of the passed values or conditions.\n\n* @param **\\Closure&#124;iterable&#124;string&#124;int** `$key` Anonymous function with (item, key) parameter, element or list of elements to test against\n* @param **string&#124;null** `$operator` Operator used for comparison\n* @param **mixed** `$value` Value used for comparison\n* @return **bool** TRUE if at least one element is available in map, FALSE if the map contains none of them\n\nCheck the [`where()`](#where)] method for available operators.\n\n**Examples:**\n\n```php\nMap::from( ['a', 'b'] )->contains( 'a' );\n\u002F\u002F true\n\nMap::from( ['a', 'b'] )->contains( ['a', 'c'] );\n\u002F\u002F true\n\nMap::from( ['a', 'b'] )->contains( function( $item, $key ) {\n    return $item === 'a'\n} );\n\u002F\u002F true\n\nMap::from( [['type' => 'name']] )->contains( 'type', 'name' );\n\u002F\u002F true\n\nMap::from( [['type' => 'name']] )->contains( 'type', '==', 'name' );\n\u002F\u002F true\n```\n\n**See also:**\n\n* [in()](#in) - Tests if element is included\n* [includes()](#includes) - Tests if element is included\n* [where()](#where) - Filters the list of elements by a given condition\n\n\n### copy()\n\nCreates a new map with the same elements.\n\n```php\npublic function copy() : self\n```\n\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\nBoth maps share the same array until one of the map objects modifies the\narray. Then, the array is copied and the copy is modfied (copy on write).\n\n**Examples:**\n\n```php\n$m = Map::from( ['foo', 'bar'] );\n\n$m2 = $m->copy();\n\u002F\u002F internal: ['foo', 'bar'] both two maps\n```\n\n**See also:**\n\n* [clone()](#clone) - Clones the map and all objects within\n\n\n### count()\n\nCounts the total number of elements in the map.\n\n```php\npublic function count() : int\n```\n\n* @return **int** Number of elements\n\n**Examples:**\n\n```php\nMap::from( ['foo', 'bar'] )->count();\n\u002F\u002F 2\n```\n\n**See also:**\n\n* [avg()](#avg) - Returns the average of all integer and float values in the map\n* [countBy()](#countby) - Counts how often the same values are in the map\n* [max()](#max) - Returns the maximum value of all elements\n* [min()](#min) - Returns the minium value of all elements\n* [percentage()](#percentage) - Returns the percentage of all elements passing the test\n* [sum()](#sum) - Returns the sum of all values in the map\n\n\n### countBy()\n\nCounts how often the same values are in the map.\n\n```php\npublic function countBy( \\Closure|string|null $col = null ) : self\n```\n\n* @param **\\Closure&#124;string&#124;null** `$col` Key as \"key1\u002Fkey2\u002Fkey3\" or closure with (value) parameter returning the values for counting\n* @return **self&#60;int&#124;string,mixed&#62;** New map with values as keys and their count as value\n\nThis does also work for multi-dimensional arrays by passing the keys\nof the arrays separated by the delimiter (\"\u002F\" by default), e.g. \"key1\u002Fkey2\u002Fkey3\"\nto get \"val\" from ['key1' => ['key2' => ['key3' => 'val']]]. The same applies to\npublic properties of objects or objects implementing __isset() and __get() methods.\n\n**Examples:**\n\n```php\nMap::from( [1, 'foo', 2, 'foo', 1] )->countBy();\n\u002F\u002F [1 => 2, 'foo' => 2, 2 => 1]\n\nMap::from( [1.11, 3.33, 3.33, 9.99] )->countBy();\n\u002F\u002F ['1.11' => 1, '3.33' => 2, '9.99' => 1]\n\nMap::from( [['i' => ['p' => 1.11]], ['i' => ['p' => 3.33]], ['i' => ['p' => 3.33]]] )->countBy( 'i\u002Fp' );\n\u002F\u002F ['1.11' => 1, '3.33' => 2]\n\nMap::from( ['a@gmail.com', 'b@yahoo.com', 'c@gmail.com'] )->countBy( function( $email ) {\n    return substr( strrchr( $email, '@' ), 1 );\n} );\n\u002F\u002F ['gmail.com' => 2, 'yahoo.com' => 1]\n```\n\n**See also:**\n\n* [avg()](#avg) - Returns the average of all integer and float values in the map\n* [groupBy()](#groupby) - Groups associative array elements or objects by the passed key or closure\n* [max()](#max) - Returns the maximum value of all elements\n* [min()](#min) - Returns the minium value of all elements\n* [percentage()](#percentage) - Returns the percentage of all elements passing the test\n* [sum()](#sum) - Returns the sum of all values in the map\n\n\n### dd()\n\nDumps the map content and terminates the script.\n\n```php\npublic function dd( ?callable $callback = null ) : void\n```\n\n* @param **callable&#124;null** `$callback` Function receiving the map elements as parameter (optional)\n\nThe `dd()` method is very helpful to see what are the map elements passed\nbetween two map methods in a method call chain. It stops execution of the\nscript afterwards to avoid further output.\n\n**Examples:**\n\n```php\nMap::from( ['a' => 'foo', 'b' => 'bar'] )->sort()->dd()->first();\n\u002F*\nArray\n(\n    [0] => bar\n    [1] => foo\n)\n*\u002F\n```\n\nThe `first()` method isn't executed at all.\n\n\n### delimiter()\n\nSets or returns the separator for paths to values in multi-dimensional arrays or objects.\n\n```php\npublic static function delimiter( ?string $char = null ) : string\n```\n\n* @param **string&#124;null** `$char` Separator character, e.g. \".\" for \"key.to.value\" instaed of \"key\u002Fto\u002Fvalue\"\n* @return **string** Separator used up to now\n\nThe static method only changes the separator for new maps created afterwards.\nAlready existing maps will continue to use the previous separator. To change\nthe separator of an existing map, use the [sep()](#sep) method instead.\n\n**Examples:**\n\n```php\nMap::delimiter( '.' );\n\u002F\u002F '\u002F'\n\nMap::from( ['foo' => ['bar' => 'baz']] )->get( 'foo.bar' );\n\u002F\u002F 'baz'\n```\n\n**See also:**\n\n* [sep()](#sep) - Sets the separator for paths to values in multi-dimensional arrays or objects\n\n\n### diff()\n\nReturns the keys\u002Fvalues in the map whose values are not present in the passed elements in a new map.\n\n```php\npublic function diff( iterable $elements, ?callable $callback = null ) : self\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$elements` List of elements\n* @param **callable&#124;null** `$callback` Function with (valueA, valueB) parameters and returns -1 (\u003C), 0 (=) and 1 (>)\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\n**Examples:**\n\n```php\nMap::from( ['a' => 'foo', 'b' => 'bar'] )->diff( ['bar'] );\n\u002F\u002F ['a' => 'foo']\n```\n\nIf a callback is passed, the given function will be used to compare the values.\nThe function must accept two parameters (value A and B) and must return\n-1 if value A is smaller than value B, 0 if both are equal and 1 if value A is\ngreater than value B. Both, a method name and an anonymous function can be passed:\n\n```php\nMap::from( [0 => 'a'] )->diff( [0 => 'A'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diff( ['B' => 'A'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diff( ['c' => 'A'], function( $valA, $valB ) {\n    return strtolower( $valA ) \u003C=> strtolower( $valB );\n} );\n\u002F\u002F []\n```\n\nAll examples will return an empty map because both contain the same values\nwhen compared case insensitive.\n\nThe keys are preserved using this method.\n\n**See also:**\n\n* [diffAssoc()](#diffassoc) - Returns the keys\u002Fvalues in the map whose keys AND values are not present in the passed elements in a new map\n* [diffKeys()](#diffkeys) - Returns the elements missing in the given list by keys\n\n\n### diffAssoc()\n\nReturns the keys\u002Fvalues in the map whose keys AND values are not present in the passed elements in a new map.\n\n```php\npublic function diffAssoc( iterable $elements, ?callable $callback = null ) : self\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$elements` List of elements\n* @param **callable&#124;null** `$callback` Function with (valueA, valueB) parameters and returns -1 (\u003C), 0 (=) and 1 (>)\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\n**Examples:**\n\n```php\nMap::from( ['a' => 'foo', 'b' => 'bar'] )->diffAssoc( new Map( ['foo', 'b' => 'bar'] ) );\n\u002F\u002F ['a' => 'foo']\n```\n\nIf a callback is passed, the given function will be used to compare the values.\nThe function must accept two parameters (valA, valB) and must return\n-1 if value A is smaller than value B, 0 if both are equal and 1 if value A is\ngreater than value B. Both, a method name and an anonymous function can be passed:\n\n```php\nMap::from( [0 => 'a'] )->diffAssoc( [0 => 'A'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diffAssoc( ['B' => 'A'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diffAssoc( ['c' => 'A'], function( $valA, $valB ) {\n    return strtolower( $valA ) \u003C=> strtolower( $valB );\n} );\n\u002F\u002F ['b' => 'a']\n```\n\nThe first and second example will return an empty map because both contain the\nsame values when compared case insensitive. In the third example, the keys doesn't\nmatch (\"b\" vs. \"c\").\n\nThe keys are preserved using this method.\n\n**See also:**\n\n* [diff()](#diff) - Returns the keys\u002Fvalues in the map whose values are not present in the passed elements in a new map\na new map\n* [diffKeys()](#diffkeys) - Returns the elements missing in the given list by keys\n\n\n### diffKeys()\n\nReturns the key\u002Fvalue pairs from the map whose keys are not present in the passed elements in a new map.\n\n```php\npublic function diffKeys( iterable $elements, ?callable $callback = null ) : self\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$elements` List of elements\n* @param **callable&#124;null** `$callback` Function with (keyA, keyB) parameters and returns -1 (\u003C), 0 (=) and 1 (>)\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\n**Examples:**\n\n```php\nMap::from( ['a' => 'foo', 'b' => 'bar'] )->diffKeys( new Map( ['foo', 'b' => 'baz'] ) );\n\u002F\u002F ['a' => 'foo']\n```\n\nIf a callback is passed, the given function will be used to compare the keys.\nThe function must accept two parameters (key A and B) and must return\n-1 if key A is smaller than key B, 0 if both are equal and 1 if key A is\ngreater than key B. Both, a method name and an anonymous function can be passed:\n\n```php\nMap::from( [0 => 'a'] )->diffKeys( [0 => 'A'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diffKeys( ['B' => 'X'], 'strcasecmp' );\n\u002F\u002F []\n\nMap::from( ['b' => 'a'] )->diffKeys( ['c' => 'a'], function( $keyA, $keyB ) {\n    return strtolower( $keyA ) \u003C=> strtolower( $keyB );\n} );\n\u002F\u002F ['b' => 'a']\n```\n\nThe first and second example will return an empty map because both contain\nthe same keys when compared case insensitive. The third example will return\n['b' => 'a'] because the keys doesn't match (\"b\" vs. \"c\").\n\nThe keys are preserved using this method.\n\n**See also:**\n\n* [diff()](#diff) - Returns the keys\u002Fvalues in the map whose values are not present in the passed elements in a new map\n* [diffAssoc()](#diffassoc) - Returns the keys\u002Fvalues in the map whose keys AND values are not present in the passed elements in a new map\n\n\n### dump()\n\nDumps the map content using the given function (print_r by default).\n\n```php\npublic function dump( ?callable $callback = null ) : self\n```\n\n* @param **callable&#124;null** `$callback` Function receiving the map elements as parameter (optional)\n* @return **self&#60;int&#124;string,mixed&#62;** Same map for fluid interface\n\nThe `dump()` method is very helpful to see what are the map elements passed\nbetween two map methods in a method call chain.\n\n**Examples:**\n\n```php\nMap::from( ['a' => 'foo', 'b' => 'bar'] )->dump()->asort()->dump( 'var_dump' );\n\u002F*\nArray\n(\n    [a] => foo\n    [b] => bar\n)\n\narray(1) {\n  [\"b\"]=>\n  string(3) \"bar\"\n  [\"a\"]=>\n  string(3) \"foo\"\n}\n*\u002F\n```\n\n\n### duplicates()\n\nReturns the duplicate values from the map.\n\n```php\npublic function duplicates( \\Closure|string|null $col = null ) : self\n```\n\n* @param **\\Closure&#124;string&#124;null** `$col` Key, path of the nested array or anonymous function with ($item, $key) parameters returning the value for comparison\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\nFor nested arrays, you have to pass the name of the column of the nested array which\nshould be used to check for duplicates.\n\nThis does also work to map values from multi-dimensional arrays by passing the keys\nof the arrays separated by the delimiter (\"\u002F\" by default), e.g. `key1\u002Fkey2\u002Fkey3`\nto get `val` from `['key1' => ['key2' => ['key3' => 'val']]]`. The same applies to\npublic properties of objects or objects implementing `__isset()` and `__get()` methods.\n\nThe keys in the result map are preserved.\n\n**Examples:**\n\n```php\nMap::from( [1, 2, '1', 3] )->duplicates()\n\u002F\u002F [2 => '1']\n\nMap::from( [['p' => '1'], ['p' => 1], ['p' => 2]] )->duplicates( 'p' )\n\u002F\u002F [1 => ['p' => 1]]\n\nMap::from( [['i' => ['p' => '1']], ['i' => ['p' => 1]]] )->duplicates( 'i\u002Fp' )\n\u002F\u002F [1 => ['i' => ['p' => 1]]]\n\nMap::from( [['i' => ['p' => '1']], ['i' => ['p' => 1]]] )->duplicates( fn( $item, $key ) => $item['i']['p'] );\n\u002F\u002F [1 => ['i' => ['p' => 1]]]\n```\n\n**See also:**\n\n* [reject()](#reject) - Removes all matched elements\n* [unique()](#unique) - Returns only unique elements from the map in a new map\n\n\n### each()\n\nExecutes a callback over each entry until FALSE is returned.\n\n```php\npublic function each( \\Closure $callback ) : self\n```\n\n* @param **\\Closure** `$callback` Function with (value, key) parameters and returns TRUE\u002FFALSE\n* @return **self&#60;int&#124;string,mixed&#62;** Same map for fluid interface\n\n**Examples:**\n\n```php\n$result = [];\nMap::from( [0 => 'a', 1 => 'b'] )->each( function( $value, $key ) use ( &$result ) {\n    $result[$key] = strtoupper( $value );\n    return false;\n} );\n\u002F\u002F $result = [0 => 'A']\n```\n\nThe `$result` array will contain `[0 => 'A']` because FALSE is returned\nafter the first entry and all other entries are then skipped.\n\n\n### empty()\n\nDetermines if the map is empty or not.\n\n```php\npublic function empty() : bool\n```\n\n* @return **bool** TRUE if map is empty, FALSE if not\n\nThe method is equivalent to isEmpty().\n\n**Examples:**\n\n```php\nMap::from( [] )->empty();\n\u002F\u002F true\n\nMap::from( ['a'] )->empty();\n\u002F\u002F false\n```\n\n**See also:**\n\n* [isEmpty()](#isempty) - Determines if the map is empty or not\n\n\n### equals()\n\nTests if the passed elements are equal to the elements in the map.\n\n```php\npublic function equals( iterable $elements ) : bool\n```\n\n* @param **iterable&#60;int&#124;string,mixed&#62;** `$elements` List of elements to test against\n* @return **bool** TRUE if both are equal, FALSE if not\n\nThe method differs to [is()](#is) in the fact that it doesn't care about the keys\nby default. The elements are only loosely compared and the keys are ignored.\n\nValues are compared by their string values:\n```php\n(string) $item1 === (string) $item2\n```\n\n**Examples:**\n\n```php\nMap::from( ['a'] )->equals( ['a', 'b'] );\n\u002F\u002F false\n\nMap::from( ['a', 'b'] )->equals( ['b'] );\n\u002F\u002F false\n\nMap::from( ['a', 'b'] )->equals( ['b', 'a'] );\n\u002F\u002F true\n```\n\n**See also:**\n\n* [is()](#is) - Tests if the map consists of the same keys and values\n\n\n### every()\n\nVerifies that all elements pass the test of the given callback.\n\n```php\npublic function every( \\Closure $callback ) : bool\n```\n\n* @param **\\Closure** `$callback` Function with (value, key) parameters and returns TRUE\u002FFALSE\n* @return **bool** True if all elements pass the test, false if if fails for at least one element\n\n**Examples:**\n\n```php\nMap::from( [0 => 'a', 1 => 'b'] )->every( function( $value, $key ) {\n    return is_string( $value );\n} );\n\u002F\u002F true\n\nMap::from( [0 => 'a', 1 => 100] )->every( function( $value, $key ) {\n    return is_string( $value );\n} );\n\u002F\u002F false\n```\n\n**See also:**\n\n* [some()](#some) - Tests if at least one element passes the test or is part of the map\n* [any()](#any) - Tests if at least one element satisfies the callback function\n\n\n### except()\n\nReturns a new map without the passed element keys.\n\n```php\npublic function except( iterable|string|int $keys ) : self\n```\n\n* @param **iterable&#60;int&#124;string&#62;&#124;array&#60;int&#124;string&#62;&#124;string&#124;int** `$keys` List of keys to remove\n* @return **self&#60;int&#124;string,mixed&#62;** New map\n\nThe keys in the result map are preserved.\n\n**Examples:**\n\n```php\nMap::from( ['a' => 1, 'b' => 2, 'c' => 3] )->except( 'b' );\n\u002F\u002F ['a' => 1, 'c' => 3]\n\nMap::from( [1 => 'a', 2 => 'b', 3 => 'c'] )->except( [1, 3] );\n\u002F\u002F [2 => 'b']\n```\n\n**See also:**\n\n* [clear()](#clear) - Removes all elements from the current map\n* [only()](#only) - Returns only those elements specified by the keys\n* [reject()](#reject) - Removes all matched elements\n* [remove()](#remove) - Removes an element by key\n\n\n### explode()\n\nCreates a new map with the string splitted by the delimiter.\n\n```php\npublic static function explode( string $delimiter, string $string, int $limit = PHP_INT_MAX ) : self\n```\n\n* @param **string** `$delimiter` Delimiter character, string or empty string\n* @param **string** `$string` String to split\n* @param **int** `$limit` Maximum number of element with the last element containing the rest of the string\n* @return **self&#60;int&#124;string,mixed&#62;** New map with sp","aimeos\u002Fmap 是一个简化 PHP 数组和集合操作的库。它提供了一个类似数组的集合对象，使得处理 PHP 数组变得更加容易和优雅，支持诸如添加、删除、过滤、排序等多种常用操作，并且语法简洁明了。该项目采用了链式调用的方式，极大提高了代码的可读性和开发效率。适合于需要频繁进行数组或集合数据处理的 PHP 项目中使用，特别是当开发者希望以更现代化、更直观的方式来管理复杂的数据结构时。","2026-06-11 03:17:49","top_language"]