From eccd5cd5a067f5659982685afdeea209b1888efb Mon Sep 17 00:00:00 2001 From: Zhineng Li Date: Sat, 14 Feb 2026 10:08:30 +0800 Subject: first commit --- build/Arr.php | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 build/Arr.php (limited to 'build/Arr.php') diff --git a/build/Arr.php b/build/Arr.php new file mode 100644 index 0000000..e9f357d --- /dev/null +++ b/build/Arr.php @@ -0,0 +1,26 @@ + $array + * @param array $keys + * @return array + */ + public static function only(array $array, array $keys): array + { + $result = []; + + foreach ($keys as $key) { + if (array_key_exists($key, $array)) { + $result[$key] = $array[$key]; + } + } + + return $result; + } +} -- cgit v1.2.3