Reply to Re: [PHP] PHP6, UTF & strlen

Your name:

Reply:


Posted by Jochem Maas on 11/28/05 18:19

Jared Williams wrote:
> Hi,
> Just been looking over some code, and saw
>
> if (strlen($data) !== file_put_contents($filename, $data))
> ....
>
> where $data is UTF8, so wondering if this is going to break in PHP6, if so what should be the equivalent code?

that currently works with UTF8 strings? or does it only work because you happen to
only ever have singlebyte characters in your strings?

currently strlen() does not give the expected value on 'multibyte' strings (or strings that contain one or more
multibyte chars) which is why the mb_*() functions exist [e.g. mb_strlen()].

In php6 all string functions should work with unicode (I believe its UTF16 internally) transparently
and therefore tyhe code you showed should not break BUT rather it should start working ;-)

don't hold your breath for php6 - making php unicode native is a complex, difficult undertaking,
it will come when its ready - given the snafu's [IMO] surrounding php5.0.5 and php5.1 I hope
they take their time.

rgds,
Jochem


>
>
> Jared
>

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация