Skip to content

Instantly share code, notes, and snippets.

@mikbox74
Last active June 11, 2019 12:51
Show Gist options
  • Save mikbox74/5d3949a00771a99f8a65210cf3d126ac to your computer and use it in GitHub Desktop.
Save mikbox74/5d3949a00771a99f8a65210cf3d126ac to your computer and use it in GitHub Desktop.
Russian plural form for PHP
<?php
$string = '7 - 21';
echo preg_replace([
'/1[1-9]{1}$/',
'/[1]{1}$/',
'/[2-4]{1}$/',
'/[0,5-9]{1}$/',
], [
'$0 дней',
'$0 день',
'$0 дня',
'$0 дней',
], $string;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment