How does php read input by byte?

Source: Internet
Author: User
How does php read input data in bytes? the first 4 bytes are numbers, 4 bytes are strings, and then 4 bytes are strings; why ?, If you are talking about the fixed length of each segment (4 bytes) $ ar = str_split ($ _ POST ['variable name'], 4 ); how to read the input in bytes for each php segment

Because someone else post the data.
The first four bytes are numbers.

4 bytes later than string

The last four bytes are different.
Why?

------ Solution --------------------
If you are talking about the fixed length of each segment (4 bytes)
$ Ar = str_split ($ _ POST ['variable name'], 4 );

If the length of each segment is not long
For example, 1, 2, 3, 4, 5
Then
$ Mask = array (1, 2, 3, 4, 5 );
$ S = $ _ POST ['variable name'];
$ N = 0;
For ($ I = 0; $ I $ Ar [] = substr ($ s, $ n, $ mask [$ I]);
$ N + = $ mask [$ I];
}



------ Solution --------------------
$ _ POST ['id'] [0]
$ _ POST ['id'] [1]
$ _ POST ['id'] [2]
$ _ POST ['id'] [3]

You can traverse it cyclically.

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.