Library provides a placeholder implementation for currying functions, partial applications, pipe operator, and other syntactic structures hat allow specifying default values.
Library can be installed into any PHP application:
$ composer require phpfn/placeholderIn order to access library make sure to include vendor/autoload.php
in your file.
<?php
require __DIR__ . '/vendor/autoload.php';What is "placeholder"?
<?php
var_dump(is_placeholder('_'));
// expected output: false
var_dump(is_placeholder(_));
// expected output: trueFor example we can replace each of the placeholders in the array with the required value.
<?php
use Fun\Placeholder\Placeholder;
$array = [1, _, 3, _];
$result = Placeholder::map($array, fn() => ' map ');
echo implode(', ', $result);
// expected output: "1, map, 3, map"And... Thats all =)