Hi, there!

I’m posting with two problems about CChoiceFormat.

Problem no 1. Sorry, because this is probably so obvious but I spent an hour to find a solution and failed! :[

I’ve noticed that CChoiceFormat::evaluate uses PHP’s eval() function (as I supposed). Why then I can’t use even simplest PHP codes in CChoiceFormat, like this one for example:

```
'strlen(n)==1#znak|n>=2 && n<5#znaki|n>=5#znakow'
```

If I’m not mistaken this should return ‘znak’ for number 1-9 as each of them has length = 1. Therefore I should get ‘7 znak’. But I don’t get it - it returns ‘7 znakow’.

Problem no 2. I’m dealing with above, because I’m trying to implement a Polish numbers ending (plural form) with CChoiceFormat. Maybe, aside of above, someone can help me with this or at least tell me, if it is possible at all?

In Polish language, an algorithm for getting proper plural ending is far more complicated than English simple "0 books / 1 book / 2 or more books’. It goes like this:

- expression1 for 1 (the only case, singular form, as in English) - for example ‘1 znak’,
- expression2 for any number, which last digit is 2-4, but
*not*for 12-14, i.e. ‘2 znaki’, ‘24 znaki’, ‘194 723 znaki’ and so on, - expression3 for any number, which last digit is 0-1 or 5-9 and including 12-14, so: ‘0 znakow’, ‘5 znakow’, ‘12 znakow’, ‘19 znakow’, ‘1147 znakow’, 111 213 znakow’

It is so complicated that before Yii I had to write own function for this, with using number-to-string and string-to-number conversion. Here is this function in pseudo-code, basing on Delphi code as I haven’t got access right now to my PHP version of this function. It should return either 1, 2 or 3 depending on which expression I should add for passed number:

```
function polish_plural(AValue);
begin
Result := '';
iResult := 3; //default - most numbers fulfil this case
//get last and last two digits for further comparision
iLast := StrToInt(Copy(IntToStr(AValue), Length(IntToStr(AValue)), 1));
iLastTwo := StrToInt(Copy(IntToStr(AValue), Length(IntToStr(AValue))-1, 2));
if (iLast > 1) and (iLast < 5) then iResult := 2; //case two - numbers with 2-4 as last digit
if (iLastTwo > 10) and (iLastTwo < 20) then iResult := 3; //force case three for numbers 11-19
if AValue = 1 then iResult := 1;//the only case - singular form - number 1.
return iResult;
end;
```

As I said, I have PHP version of above function. But I wonder if there would be any way to implement the same logic with CChoiceFormat to avoid using this function?

Any help would be much appreciate!