PHP definition Array and usage examples

Source: Internet
Author: User
Tags array definition php definition php example

This article mainly introduces the PHP definition array and uses the example (PHP array definition method), needs the friend to be possible to refer to under

This is a php example of an array, a brief description of the basic use of the array, the example added the annotation code as follows: <?php//define an array of strings $fruit = Array ("Apple", "orange");   The value of the reference array is $fruit [0];//represents the value of the Apple $fruit [1];//represents orange//note that the index of the array is from 0, and people who have studied C and Java know it. Defines an array of numeric values $number = Array (1,2,3,4,5);//reference array value IBID.//To define a conforming array $mix = Array (1, "Example", "Hello", 2.5);//reference array value IBID.//Also available Defines an array $ex by key value = Array ("A" => "fruit", "B" => "Car"); You can refer to the $ex ["a"];//the corresponding value is the fruit $ex ["B"];//corresponds to the value is the car//can also create such a key-value-compliant array?>

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.