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


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to