pike.hubbe.net

[Top]
previous`<<() map_array()next

Method map()


Method map

array map(array arr, function|program|object|array fun, mixed ... extra)
array map(array arr, multiset|mapping fun)
array map(array arr, string fun, mixed ... extra)
array map(array arr, void|object(zero) null, mixed ... extra)
mapping map(mapping|program|function arr, mixed fun, mixed ... extra)
multiset map(multiset arr, mixed fun, mixed ... extra)
string map(string arr, mixed fun, mixed ... extra)
mixed map(object arr, mixed fun, mixed ... extra)

Description

Map a function over elements.

Returns

Generally the same datatype as given, but with the subtype set to the return value of the function; the exception are program and function that give a mapping back.

Note

You may get unexpected errors if you feed the function with illegal values; for instance if fun is an array of non-callables.

See also

filter, enumerate, foreach()


Extracted from Pike v7.3 release 11 at 2001-11-03.