Play the PHP Array (ii)
' www.xinhuastm.com ');//reading an array element echo $arr [2], '
'; echo $arr [' url '], '
';//what type of value is allowed for the array cell? PHP has 8 types of variables//A: Can accommodate all legal types in PHP, that is, 8 kinds of can, means that the value of the cell, also can be an array//the following case, called "two-dimensional array" $arr =array (' One ' =>array (' name ' = ' Xin Hua eco-wood ', ' url ' = ' www.xinhuastm.com '), ' =>array ' (' name ' = ' ' Love Bo Eco-wood ', ' url ' = ' www.lyaibo.com '));p Rint_r ($arr); Echo $arr [' One '] [' name '];/* result: Array ([one] + = Array ([name] = [url] = > www.xinhuastm.com) [+] = Array ([name] = [url] = Www.lya ibo.com) xinhuastm*///adds units to the array $arr =array (' Zhong ', ' Hua ', ' min '); $arr []= ' clan '; Echo '
';p rint_r ($arr);//Modify the cell value of an array//Specify an existing array unit and assign a value to it. $arr [3]= ' Hua '; Echo '
';p rint_r ($arr);/* Results: Array ([0] = [1] = [2] = [3] = =)------------------------------------------- -array ([0] = [1] = [2] = [3] = wah) *///Delete a unit unset ($arr [2]); Echo '
';p rint_r ($arr);/* Results: Array ([0] = [1] = [3] = China) */?>