Skip to content

Instantly share code, notes, and snippets.

@mcjwsk
Created August 18, 2015 11:33
Show Gist options
  • Save mcjwsk/a89de9124021c6f7db82 to your computer and use it in GitHub Desktop.
Save mcjwsk/a89de9124021c6f7db82 to your computer and use it in GitHub Desktop.
<?php
$langs = array(
0 => '1 produkt',
1 => '%d produkty',
2 => '%d produktów',
);
$n = 9;
$plural = (($n==1)?(0):((((($n%10)>=2)&&(($n%10)<=4))&&((($n%100)<10)||(($n%100)>=20)))?(1):2));
printf($langs[$plural], $n);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment