hivokas/correct-word-form

Package provides ability to get the correct word form depending on the number before this word.

1.0.0 2018-02-14 10:17 UTC

This package is auto-updated.

Last update: 2024-11-19 10:12:55 UTC


README

Package provides ability to get the correct word form depending on the number before this word.

GitHub stars GitHub forks GitHub issues GitHub license contributions welcome

Installation

composer require hivokas/correct-word-form

Usage examples

Russian

for ($i = 0; $i < 5; $i++) {
  $amount = rand(-20, 200) / 2;
  echo $amount . ' ' . Hivokas\CorrectWordForm\CorrectWordForm::ru($amount, 'яблоко', 'яблока', 'яблок') . PHP_EOL;
}
23.5 яблока
-7.5 яблок
33 яблока
2 яблока
41.5 яблоко

English

for ($i = 0; $i < 5; $i++) {
  $amount = rand(-20, 200) / 2;
  echo $amount . ' ' . Hivokas\CorrectWordForm\CorrectWordForm::en($amount, 'apple', 'apples') . PHP_EOL;
}
67.5 apples
1 apple
54.5 apples
33.5 apples
25 apples

Supported languages