protected static function convertTri($num, $tri)
{
// chunk the number ...xyz
$x = (int) ($num / 1000);
$y = $num / 100 % 10;
$z = $num % 100;
// init the output string
$str = "";
$ones = static::ones();
$tens = static::tens();
$triplets = static::triplets();
// do hundreds
if ($y > 0) {
$str = $ones[$y] . ' ' . Yii::t('kvenum', 'hundred');
}
// do ones and tens
$str .= $z < 20 ? $ones[$z] : $tens[(int) ($z / 10)] . $ones[$z % 10];
// add triplet modifier only if there is some output to be modified...
if ($str != "") {
$str .= $triplets[$tri];
}
// recursively process until valid thousands digit found
return $x > 0 ? static::convertTri($x, $tri + 1) . $str : $str;
}