Last active
June 11, 2019 12:51
-
-
Save mikbox74/5d3949a00771a99f8a65210cf3d126ac to your computer and use it in GitHub Desktop.
Russian plural form for PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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