1. Go to this page and download the library: Download cdn77/functions library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
cdn77 / functions example snippets
use function Cdn77\Functions\assert_return;
array_map(
fn (mixed $value) => new RequiresInt(assert_return($value, is_int(...))),
[1, 2, 3]
);
match ($val) {
'1' => throw new Exception,
'2' => foo(),
default => noop(),
};
use function Cdn77\Functions\mapFromEntries;
$map = mapFromEntries([
['foo', 'bar'],
['baz', 'qux'],
]);
assert($map->get('foo') === 'bar');
use function Cdn77\Functions\Iterable\find;
$iterable = [0, 1, 2, 3];
$option = find($iterable, static fn (mixed $_, int $value) => $value < 2);
assert($option->unwrap() === 0);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.