map php,PHP Map 用法 手册 | 示例代码

荆炳
2023-12-01

DsMap::allocate — Allocates enough memory for a required capacity

DsMap::apply — Updates all values by applying a callback function to each value

DsMap::capacity — Returns the current capacity

DsMap::clear — Removes all values

DsMap::__construct — Creates a new instance

DsMap::copy — Returns a shallow copy of the map

DsMap::count — Returns the number of values in the map

DsMap::diff — Creates a new map using keys that aren’t in another map

DsMap::filter — Creates a new map using a callable to determine which pairs to include

DsMap::first — Returns the first pair in the map

DsMap::get — Returns the value for a given key

DsMap::hasKey — Determines whether the map contains a given key

DsMap::hasValue — Determines whether the map contains a given value

DsMap::intersect — Creates a new map by intersecting keys with another map

DsMap::isEmpty — Returns whether the map is empty

DsMap::jsonSerialize — Returns a representation that can be converted to JSON

DsMap::keys — Returns a set of the map’s keys

DsMap::ksort — Sorts the map in-place by key

DsMap::ksorted — Returns a copy, sorted by key

DsMap::last — Returns the last pair of the map

DsMap::map — Returns the result of applying a callback to each value

DsMap::merge — Returns the result of adding all given associations

DsMap::pairs — Returns a sequence containing all the pairs of the map

DsMap::put — Associates a key with a value

DsMap::putAll — Associates all key-value pairs of a traversable object or array

DsMap::reduce — Reduces the map to a single value using a callback function

DsMap::remove — Removes and returns a value by key

DsMap::reverse — Reverses the map in-place

DsMap::reversed — Returns a reversed copy

DsMap::skip — Returns the pair at a given positional index

DsMap::slice — Returns a subset of the map defined by a starting index and length

DsMap::sort — Sorts the map in-place by value

DsMap::sorted — Returns a copy, sorted by value

DsMap::sum — Returns the sum of all values in the map

DsMap::toArray — Converts the map to an array

DsMap::union — Creates a new map using values from the current instance and another map

DsMap::values — Returns a sequence of the map’s values

DsMap::xor — Creates a new map using keys of either the current instance or of another map, but not of both

 类似资料: