Learn PHP for new users. I have a few questions about Arrays. I hope you can give me some advice.

Source: Internet
Author: User
Learn PHP for new users. I have a few questions about Arrays. I hope you can give me some advice.
 


". $ _ POST ['xh'] [$ I]."What does this sentence mean? Why should I add "[" xh "]"? Two "."What does it mean?
Why does $ XH get an array after submission? Isn't the array () function used to create an array?


Reply to discussion (solution)

Is a string connection operation.

Why should I use html arrays like name = 'xh [] '?
Reference
Http://php.net/manual/zh/faq.html.php#faq.html.arrays

In fact, this is the case when the browser posts the past data (located below the http header)

Xh [] = first value & xh [] = second value

Php will resolve
$ _ POST ['xh'] = array (
0 => 'first value ',
1 => 'second value'
)

Therefore, $ _ POST ['xh'] [0] will obtain the 'first value'

Normally (no form array is used)
Browser end


After the POST is sent to the server, php will parse it
$ _ POST ['xh'] = 0;

Here. it does not work. for example, the first floor is the operator that connects strings. "A". "B" = "AB"

Is a string connection operation.


Not very understandable... If it is a reference, isn't it necessary to add a. in front of the variable? Why should I add a. after the front and the back? if I remove the later one, an error is returned ..

    echo "";


Echo is followed by three strings (double quotation marks are red below)
The first one is :" The third is: "'>"

I am not used to concatenate strings in this way and use printf or sprintf functions similar to c.
printf("", $_POST['xh'][$i] );

    echo "";


Echo is followed by three strings (double quotation marks are red below)
The first one is :" The third is: "'>"

I am not used to concatenate strings in this way and use printf or sprintf functions similar to c.
printf("", $_POST['xh'][$i] );


Well, I have understood the code more recently ..
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.