Php array (2)

Source: Internet
Author: User
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 cell's & quot; credential is used to play with the 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) */?>

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.