Mecha CMS

Helper functions.

k

Filter g results by query.

2.0.0

k(string $folder, string $x, int $deep = 0, array $query = [], bool $content = false);
k(string $folder, int $type, int $deep = 0, array $query = [], bool $content = false);
k(string $folder, callable $fn, int $deep = 0, array $query = [], bool $content = false);

Example:

$query = ['foo', 'bar'];

// Search `foo` and `bar` in file name
foreach (k('.\path\to\folder', 1, 0, $query) as $path => $type) { … }
// Search `foo` and `bar` in file content as well
foreach (k('.\path\to\folder', 1, 0, $query, true) as $path => $type) { … }