How does PHP stitch binary data into strings?

Source: Internet
Author: User
Binary PHP utf-8 encoding

For example, the character "You" of the UTF8 code is "e4bda0".
Now there is an array of $arr
$arr = Array (chr (228), Chr (189), Chr (160));

How do you stitch it up into a piece that allows it to print out the characters "you"?
Ask for help


Reply to discussion (solution)

$arr = Array (chr (228), Chr (189), CHR), echo join ("', $arr); Your foreach ($arr as $v) echo $v; for ($i =0; $i
   
  

Echo Pack (' h* ', ' e4bda0 '); Echo hex2bin (' e4bda0 ');

$arr = Array (chr (228), Chr (189), CHR), echo join ("', $arr); Your foreach ($arr as $v) echo $v; for ($i =0; $i
   
     
     

echo Pack (' h* ', ' e4bda0 '); echo  
 Hex2bin (' e4bda0 '); 

Thank you ~ The following two are possible ~
It is strange that I used to print a join yesterday is three characters ~ today even join available ~
Just don't know how join performance ~

J Oin in the internal loop, certainly more than you do in the code loop to do the fast

join in the internal loop, certainly more than you do in the code loop to do the fast
I was in the improvement of a template engine, before the two posts asked the regular expression matching mark Sign of the question ~ did not
helpless, I decided to write a parser ~ Unfortunately PHP does not support pointers and memory copy and other high-performance things, do not know how to get the performance of this method to lose how much ~

Not because of "worry" and timid
Performance is compared, you have to do a few more programs.
There are comparisons to be identified!

PHP is interpreted as executing, and each instruction takes a bit of time to
Cycle as well as more time. Recursion is also the loop
Recognition mode, the string function loop is better than regular
can use an iterator to not loop itself
...

Not because of "worry" and timid
performance is compared, you have to do a few more programs.
There are comparisons to be identified!

PHP is interpreted as executing, and each instruction takes a bit of time to
Cycle as well as more time. Recursion is also the loop
Recognition mode, the string function loop is better than regular
can use an iterator to not loop itself
...
Thank you ~ Thank you ~

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.