<?php

use Illuminate\Support\Str;

/**
 * Unmask turkmen number
 */
function unMaskTurkmenNumber(string|int $number): string
{
    return Str::of((string) $number)
        ->replaceMatches('/[^\d]/', '')     // keep only digits
        ->whenStartsWith('993', fn ($str) => $str->after('993'))
        ->value();
}
