Questions about array output

Source: Internet
Author: User
The array structure of array output is as follows $ a = array ('A', 'B', 'C'); $ a [0] = array ('A ', 'AB', 'AC', 'AD'); $ a [1] = array ('A', 'AB', 'AC', 'AD '); echo & nbsp; $ a [2]; the output is normal. the output is c & nbsp; because $ a [2] does not define the array output.
The array structure is as follows:

$ A = array ('A', 'B', 'C ');
$ A [0] = array ('A', 'AB', 'AC', 'AD ');
$ A [1] = array ('A', 'AB', 'AC', 'AD ');

Echo $ a [2];

The output is normal. The Output c is because $ a [2] does not have an array defined.

How to input a in one dimension.
Echo $ a [0];


------ Solution --------------------
There is no a in one dimension.
He has been overwritten by $ a [0] = array ('A', 'AB', 'AC', 'AD ');

You can see print_r ($ );
------ Solution --------------------
Reference:
There is no a in one dimension.
He has been overwritten by $ a [0] = array ('A', 'AB', 'AC', 'AD ');

You can see print_r ($ );


Positive solution
------ Solution --------------------
$ A = array ('A', 'B', 'C ');
$ A [0] = array ('A', 'AB', 'AC', 'AD ');
After Execution
$ A = array (
Array ('A', 'AB', 'AC', 'AD '),
'B ',
'C'
)
$ A [1] = array ('A', 'AB', 'AC', 'AD ');
After Execution
$ A = array (
Array ('A', 'AB', 'AC', 'AD '),
Array ('A', 'AB', 'AC', 'AD '),
'C'
)

Therefore:
$ A [0] = array ('A', 'AB', 'AC', 'AD ')
$ A [1] = array ('A', 'AB', 'AC', 'AD ')
$ A [2] = c

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.