You may make mistakes in php array operations...

Source: Internet
Author: User
1. is the key name an error caused by quotation marks: & amp; lt ;? Php $ array = array (3 = & amp; gt; & quot; number & quot;, '3' = & amp; gt; & quot; character & quot ;); echo $ arra

1. whether the key name contains quotation marks:


 "Number", '3' => "character"); echo $ array [3]; // character echo $ array ['3']; // character

The former is the value of the fourth element, and the latter is the value of the element whose return key name is 3.

2. string value:


 

The character in the string can be searched and modified using a square brackets similar to the array structure containing the corresponding numbers, such as $ str [42], you can think of strings as arrays. Of course, you can modify the value of a character in the string.

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.