From bcaf3310b2aa1918f2c7c93af306133de063e7b3 Mon Sep 17 00:00:00 2001 From: Robert Date: Thu, 18 Jun 2026 23:00:07 -0400 Subject: [PATCH] Added getDigitsAndLettersOnly... --- src/Framework/Common.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Framework/Common.php b/src/Framework/Common.php index b3fbece..4474b35 100644 --- a/src/Framework/Common.php +++ b/src/Framework/Common.php @@ -49,6 +49,11 @@ final class Common return (self::getCount($data) > 0) ? true : false; } + /** + * Is the Array item or Has Keys like key=>value? + * @param array $array + * @return bool + */ public static function hasKeys(array $array): bool { return array_keys($array) !== range(0, count($array) - 1); @@ -97,6 +102,13 @@ final class Common } return false; // Empty Data..., return false } + + public static function getDigitsAndLettersOnly(false|null|string $input): ?string { + if ($input === false || $input === null) { + return null; + } + return preg_replace('/[^a-zA-Z0-9]/', '', $input); + } public static function safeFlipArray(?array $data): array {