nerd-components / lambda
Lambda-function generator
Installs: 98
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 0
Forks: 0
pkg:composer/nerd-components/lambda
Requires
- php: >=7.4
Requires (Dev)
- phpunit/phpunit: ^9.5.6
- satooshi/php-coveralls: ^v0.7.1
- squizlabs/php_codesniffer: ~3.6.0
This package is not auto-updated.
Last update: 2025-10-19 11:27:35 UTC
README
Generates lambda function using given string pattern.
Example
use function Lambda\l; // Unindexed placeholders mode $sum = l('$ + $'); echo $sum(2, 4); // will output 6 // Indexed placeholders mode $func = l('$0 + ($0 * $1)'); echo $func(2, 6); // will output 14 // Filtering function $numbers = range(1, 10); $evens = array_filter(l('$ % 2 == 0'), $numbers); // will produce array [2, 4, 6, 8, 10]