if ( !preg_match( "/[a-zA-Z_]/us", $word ) ) {
switch ( $case ) {
case 'genitive': # սեռական հոլով
- if ( join( '', array_slice( $ar[0], -1 ) ) == 'ա' ) {
- $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
- } elseif ( join( '', array_slice( $ar[0], -1 ) ) == 'ո' ) {
- $word = join( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
- } elseif ( join( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) {
- $word = join( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
+ if ( implode( '', array_slice( $ar[0], -1 ) ) == 'ա' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'այի';
+ } elseif ( implode( '', array_slice( $ar[0], -1 ) ) == 'ո' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -1 ) ) . 'ոյի';
+ } elseif ( implode( '', array_slice( $ar[0], -4 ) ) == 'գիրք' ) {
+ $word = implode( '', array_slice( $ar[0], 0, -4 ) ) . 'գրքի';
} else {
$word .= 'ի';
}
}
return $word;
}
-
- /**
- * Armenian numeric format is "12 345,67" but "1234,56"
- *
- * @param string $_
- *
- * @return string
- */
- function commafy( $_ ) {
- if ( !preg_match( '/^\d{1,4}$/', $_ ) ) {
- return strrev( (string)preg_replace( '/(\d{3})(?=\d)(?!\d*\.)/', '$1,', strrev( $_ ) ) );
- } else {
- return $_;
- }
- }
}