diff --git a/www/first/index.php b/www/first/index.php index fc3f666..b79c5c2 100644 --- a/www/first/index.php +++ b/www/first/index.php @@ -33,7 +33,32 @@ "date" => "today" ]; + function filter(array $items): array + { + $filtered = []; + + foreach ($items as $item) { + if (str_contains($item, "1")) { + $filtered[] = $item; + } + } + return $filtered; + } + + function filterGeneric(array $items, callable $filter): array + { + $filtered = []; + + foreach ($items as $item) { + if ($filter($item)) { + $filtered[] = $item; + } + } + return $filtered; + } ?> + +