Play PHP Array (i)
Binghui [Sex] = male [age] + 20) *///initialization mode, easy to run, temporarily add a unit $stu1[' height ']= ';p rint_r ($stu 1);/*array ( [Name] = Binghui [Sex] = [age] = [ height] = +] *///===array structure to create =====//$stu 1=array (' name ' = ' Binghui ', ' Sex ' = ' ' male ', ' age ' = ' + ');p Rint_r ($stu 1);/* result Array ( [name] + Binghui [sex] + male [age] = = */?>)
Mei [1] = [2] [+] = [3] = [$stu[] = [+] [[] =] [[' Grade '] = ' 174 ', ' *///'] = [' School number '] = 234; Sophomore '; $stu [] = ' Hengshui ';p rint_r ($STU);/* Result: Array ([student] = 234 [name] = Lie triple [0] = 174 [Grade] = sophomore [1] =& Gt Hengshui) *//*** If the square brackets are given but no key name is specified, the current maximum integer index value is taken, and the new key name is the value + 1. The previous example starts with 5+1 If no integer index is currently present, the key name is 0. In $yan if the specified key name already has a value, the value will be overwritten. (see example below) ***/$butty [] = ' Lin Chi-ling '; Key = 0 $butty [] = ' Cang jing empty '; Key = 1 $butty [1] = ' Enrique '; Indicate key = 1 unit, value is Enrique, this is actually again the contents of the 1th cabinet modified to "Enrique" $butty [3] = ' Ozawa xxx '; Print_r ($butty); /*array ([0] = Lin Chi-ling [1] = enrique [3] = Ozawa xxx) *///above these 3 examples, discusses the relationship between the growth of a clear key. $arr = Array (' Medium ', ' China ', ' people ', ' country '); 0 1 2 3 print_r ($arr); Unset ($arr [3]); Print_r ($arr); $arr [] = ' family '; Print_r ($arr); The key is: 0124, delete a unit, the growth of the key is not affected by this effect, continue to increase./*array ([0] = [1] = [2] [+] [3] = = Country) Array ([0] =&G T