On Sun, Jun 16, 2013 at 1:54 PM, Andrey Pashentsev <avp200...@mail.ru>wrote:

> **
> Below is what I got (php5.4):
> 1)
> Script is in utf-8 with BOM encoding. zend.multibyte is enabled
> (to use this feature, mbstring extension must be enabled).
> <?php
> echo strlen('ы'); //russian letter
> $str = 'äå';
> echo "\n" . strlen($str);
> ?>
>
> Output:
> 1
> 2
>
> 2)
> Script is in utf-8 encoding. zend.multibyte is disabled.
> <?php
> echo strlen('ы');
> $str = 'äå';
> echo "\n" . strlen($str);
> ?>
>
> Output:
> 2
> 4
>
>

I have no clue how you're getting that result.

If I run your code with zend.multibyte enabled I still get the same results
as I do with it turned off.

var_dump(ini_get('zend.multibyte'));
echo strlen('ы'); //russian letter
$str = 'äå';
echo "\n" . strlen($str);


/* Output */

string(1) "1"
2
4


Nowhere do I see zend.multibyte documented to affect the behavior of strlen
anywhere in the code or the documentation. This configuration is clearly
documented to affect the way the engine parses the source files. I can't
reproduce what you're saying and I also can't find a single line of code in
the source to support your claim.



>  "Sherif Ramadan" <theanomaly...@gmail.com> сообщил/сообщила в новостях
> следующее:
> news:cal+t6cgpn+vnzak+g5i-c4cjllsorweal7rbhco38-t_7ow...@mail.gmail.com...
>
>
>
> On Sun, Jun 16, 2013 at 3:51 AM, Andrey Pashentsev <avp200...@mail.ru>wrote:
>
>>
>> "Adam Kazimierczak" <kazym...@gmail.com> сообщил/сообщила в новостях
>> следующее: news:51BA2CC5.3060508@gmail.**com...
>>
>> Hello Mailing List,
>>>
>>> I found that strlen is often considered as a function that counts
>>> characters in strings, rather than bytes. Such mistake is even often
>>> seen on blogs or tutorials, so many PHP beginners may get confused when
>>> they try to strlen a multi-byte characters string.
>>>
>>> I am attaching a patch proposition where the description notes that
>>> length is measured in bytes and adds an example showing results of
>>> strlen used on multi-byte character strings.
>>>
>>> Please let me know what do you think about this.
>>>
>>> Cheers,
>>> Adam
>>>
>>>
>> Hi Adam
>>
>>
>> I found that strlen is often considered as a function that counts
>>> characters in strings, rather than bytes.
>>>
>>
>> Don't forget about zend.multibyte feature...
>>
>> If it is on and you have a script in 'utf-8 with BOM' encoding
>> php will detect it and strlen will take this into account.
>>
>>
> zend.multibyte enables the PHP engine to parse source files that are in
> multibyte encodings. It has nothing to do with the behavior of strlen, nor
> does it change the behavior of the function.
>
>
>>
>> Cheers,
>> Andy
>>
>>
>

Reply via email to