This is written in C#
ASCIIEncoding asciiEncoding = new ASCIIEncoding();
byte[] something= new byte[checked (buffer.Length - 1 + 1)];
str = asciiEncoding.GetString(something);
I am trying to find a function in PHP that does the same thing as asciiEncoding.GetString()
Is there any?
asciiEncoding.GetString
will decode a byte array into a string. In PHP it could look like this:
$byteArray = unpack('C*', 'Some string');
$str = implode(array_map('chr', $byteArray));
System.Text.ASCIIEncoding AE = new System.Text.ASCIIEncoding(); //创建一个 ASCII字符集语境
byte[] writestream = AE.GetBytes(str) //利用该语境从字符串创建字节数组