Ds\Deque::map
(PECL ds >= 1.0.0)
Ds\Deque::map — Returns the result of applying a callback to each value.
Описание
Returns the result of applying a callback
function to
each value in the deque.
Список параметров
-
callback
-
A callable to apply to each value in the deque.
The callable should return what the new value will be in the new deque.
Возвращаемые значения
The result of applying a callback
to each value in
the deque.
Замечание:
The values of the current instance won't be affected.
Примеры
Пример #1 Ds\Deque::map() example
<?php
$deque = new \Ds\Deque([1, 2, 3]);
print_r($deque->map(function($value) { return $value * 2; }));
print_r($deque);
?>
Результатом выполнения данного примера будет что-то подобное:
Ds\Deque Object ( [0] => 2 [1] => 4 [2] => 6 ) Ds\Deque Object ( [0] => 1 [1] => 2 [2] => 3 )
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения, относящиеся к переменным и типам
- Data Structures
- Ds\Deque::allocate
- Ds\Deque::apply
- Ds\Deque::capacity
- Ds\Deque::clear
- Ds\Deque::__construct
- Ds\Deque::contains
- Ds\Deque::copy
- Ds\Deque::count
- Ds\Deque::filter
- Ds\Deque::find
- Ds\Deque::first
- Ds\Deque::get
- Ds\Deque::insert
- Ds\Deque::isEmpty
- Ds\Deque::join
- Ds\Deque::jsonSerialize
- Ds\Deque::last
- Ds\Deque::map
- Ds\Deque::merge
- Ds\Deque::pop
- Ds\Deque::push
- Ds\Deque::reduce
- Ds\Deque::remove
- Ds\Deque::reverse
- Ds\Deque::reversed
- Ds\Deque::rotate
- Ds\Deque::set
- Ds\Deque::shift
- Ds\Deque::slice
- Ds\Deque::sort
- Ds\Deque::sorted
- Ds\Deque::sum
- Ds\Deque::toArray
- Ds\Deque::unshift
Коментарии
404 Not Found