Php array (2) & lt ;? The php array has been created. how do I read a unit value in the array? What types of values can an array unit contain? How to add a cell to an array? How do I change a unit value in an array? How do I delete an array cell? Everything has to consider the value of the Read unit from the & quot; key value & quot; --- a cabinet is a unit, and a unit is a php array (2)
'Www .xinhuastm.com '); // read the array element echo $ arr [2],'
'; Echo $ arr ['URL'],'
'; // What type is the value of the array unit allowed? // PHP has eight variable types. // A: It can accommodate all valid types in PHP, that is, 8 types are allowed, meaning that the value of a unit is, it can also be an array // in this case, called a "two-dimensional array" $ arr = array ('one' => array ('name' => 'Xinhua eco-wood ', 'URL' => 'Www .xinhuastm.com '), 'two' => array ('name' => 'obo eco-M', 'URL' => 'Www .lyaibo.com ')); print_r ($ arr); echo $ arr ['one'] ['name'];/* result: array ([one] => Array ([name] => Xinhua eco-Wood [url] => www.xinhuastm.com) [two] => Array ([name] => Aibo ecosystem [url] => www.lyaibo.com) xinhuastm * // add a unit to the array $ arr = Array ('中 ', 'hua', 'min'); $ arr [] = 'clan '; echo'
'; Print_r ($ arr); // modify the unit value of the array // specify an existing array unit and assign a value. $ arr [3] = 'hua'; echo'
'; Print_r ($ arr);/* result: Array ([0] => center [1] => China [2] => min [3] => family) ------------------------------------------ Array ([0] => China [2] => China [3] => China) * /// delete a unit unset ($ arr [2]); echo'
'; Print_r ($ arr);/* result: Array ([0] => center [1] => China [3] => China) */?>