Skip to content

Latest commit

 

History

History
29 lines (18 loc) · 464 Bytes

File metadata and controls

29 lines (18 loc) · 464 Bytes

constant

Description

It wraps a value into a closure, which return the same value that is passed as argument whenever is called.

Parameters

value
Any type of value that will be returned

Examples

Fill an existing array with zeros:

<?php

use function Lambdish\Phunctional\map;
use function Lambdish\Phunctional\constant;
 
$numbers = [1, 2, 3, 4, 5];

map(constant(0), $numbers);

// => [0, 0, 0, 0, 0]