How does PhP internally represent string?
Posted
by
Jim Thio
on Programmers
See other posts from Programmers
or by Jim Thio
Published on 2012-06-02T14:41:03Z
Indexed on
2012/06/02
16:48 UTC
Read the original article
Hit count: 257
UTF8?
UTF16?
Does the string in PhP also keep tracks the encoding used for that string?
A good answer would give me a sample of
Let's look at this script for example.
Say I do
$original = "??????????????";
What actually happen?
Obviously I think $original will not contain just 7 characters. Those glyps must each be represented by several bytes there.
Then I do
$converted= mb_convert_encoding ($original , "UTF-8")
What will happen to $converted? How will $converted be different than $original?
Will it be just the exact same byte sequence with $original but with different encoding?
Or what?
© Programmers or respective owner