Php study notes: php array summary

Source: Internet
Author: User
Php study notes: php array summary

  1. Foreach ($ arr as $ key => $ value)
  2. {
  3. Echo $ value ."
    ";
  4. }

2) when $ arr [] is assigned a value, the array subscript uses the current maximum subscript + 1 ($ arr [maximum + 1]) as the subscript. example:

 
     $value) { echo $key.' ='.$value."
"; } //output:/*0 =11 =str2 =4 =45 =xint2 =76 =xx*/?>

4. in php, the array is automatically added, which is different from the 5 in c ++. for the array function 1, count counts the number of arrays. 2) isarray: determine whether a variable is an array. 3) split explode text. 4) unset destroys the elements of a variable or array. After unset is destroyed, the sequence of the array is not changed. 6. the array operator $ a + $ B adds array B to array a, except for the same key. The same key is not overwritten. The same is true for numeric subscripts.

     'fsf','b'=>'fsdfss');$b=array('a'=>'china','b'=>'huc','c'=>'lengai');$c=$a+$b;print_r($c);//Array ( [a] => fsf  => fsdfss [c] => lengai )?>

Code description: $ a ==$ B array a and array B have the same key value $ a ===$ B array a and array B. Not only must the key value be the same, but the order be the same. $ A <> $ B array a is different from array B. $! = $ B array a and array B are incomplete. Let's sum up. I hope it will help you. To learn php programming, let's go to the programmer's home.

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.