1. Go to this page and download the library: Download nancheng/pfinal-array 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/ */
nancheng / pfinal-array example snippets
use function pf\arr\filter;
use function pf\arr\pipe;
use function pf\arr\pluck;
use function pf\arr\sortBy;
use function pf\arr\unique;
$names = pipe(
$rows,
filter(fn (array $row): bool => $row['active']),
pluck('name'),
unique(),
sortBy(fn (string $name): string => $name),
);
use function pf\arr\dot;
use function pf\arr\get;
use function pf\arr\pull;
get('user.name', '未知')($data);
pull('user.name')($data);
// ['value' => '南丞', 'array' => [...]]
dot()(['user' => ['name' => '南丞'], 'tags' => ['php']]);
// ['user.name' => '南丞', 'tags.0' => 'php']
use function pf\arr\orderBy;
use function pf\arr\pipe;
use function pf\arr\pluck;
$names = pipe(
$rows,
orderBy('city', ['age', 'desc']),
pluck('name'),
);
use function pf\arr\groupBy;
use function pf\arr\merge;
use function pf\arr\tree;
groupBy('city', 'age')($rows);
merge(['a' => ['b' => 2, 'c' => 3]])(['a' => ['b' => 1], 'e' => 5]);
// ['a' => ['b' => 2, 'c' => 3], 'e' => 5]
tree()($nodes);
use function pf\arr\dateMap;
use function pf\arr\range;
range(1, 5, 2); // [1, 3, 5]
dateMap('2026-01-01', '2026-01-03', 0);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.