This commit is contained in:
2026-07-16 14:33:57 +03:30
parent 41c2a20fd0
commit 69538226d2
9 changed files with 28 additions and 73 deletions
-24
View File
@@ -1,24 +0,0 @@
<?php
namespace App\Support;
class PersianDigits
{
public static function toEnglish(mixed $value): mixed
{
if (is_string($value)) {
$persian = ['۰', '۱', '۲', '۳', '۴', '۵', '۶', '۷', '۸', '۹'];
$arabic = ['٠', '١', '٢', '٣', '٤', '٥', '٦', '٧', '٨', '٩'];
$latin = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
$value = str_replace(array_merge($persian, $arabic), array_merge($latin, $latin), $value);
return str_replace('٫', '.', $value);
}
if (is_array($value)) {
return array_map([self::class, 'toEnglish'], $value);
}
return $value;
}
}