0) { $part = $whole % 1000; $whole = (int) ($whole / 1000); if ($part > 0) { $words = self::convertToWords($part).' '.self::$largeNumbers[$level].' '.$words; } $level++; } return trim($words).' manat'; } /** * Convert the fractional part of the number. * * @param int $fraction The fractional part of the number. * @return string The converted fractional part in Turkmen. */ private static function convertFractionalPart($fraction) { if ($fraction <= 0) { return ''; } $fractionTens = (int) ($fraction / 10); $fractionUnits = $fraction % 10; $words = ''; $words .= ($fractionTens > 0 ? self::$tens[$fractionTens].' ' : ''); $words .= ($fractionUnits > 0 ? self::$units[$fractionUnits].' ' : ''); return trim($words).' teňňe'; } /** * Convert a number up to 999 to Turkmen words. * * @param int $num The number to convert. * @return string The converted number in Turkmen. */ private static function convertToWords($num) { $words = ''; if ($num >= 100) { $hundredsPart = (int) ($num / 100); $num %= 100; $words .= self::$hundreds[$hundredsPart].' '; } if ($num >= 10) { $tensPart = (int) ($num / 10); $num %= 10; $words .= self::$tens[$tensPart].' '; } if ($num > 0) { $words .= self::$units[$num].' '; } return trim($words); } }