PHP uses array_fill to define multi-dimensional arrays. array_fill multi-dimensional _ PHP Tutorial

Source: Internet
Author: User
PHP uses array_fill to define multi-dimensional arrays. array_fill is multi-dimensional. PHP uses array_fill to define multi-dimensional arrays. array_fill this article describes how PHP uses array_fill to define multi-dimensional arrays. Share it with you for your reference. Specific Analysis: for example, PHP uses array_fill to define multi-dimensional arrays, and array_fill is multi-dimensional.

This example describes how PHP uses array_fill to define multi-dimensional arrays. Share it with you for your reference. The specific analysis is as follows:

In PHP, multiple array_fill nesting can be used to define multi-dimensional arrays:

$ Creation = array_fill (0, 3, array_fill (0, 2, null ));

You can fill in the following statement:

$ Abc = 0; for ($ I = 0; $ I <3; $ I ++) {for ($ j = 0; $ j <2; $ j ++) {$ abc = $ abc + 1; $ creation [$ I] [$ j] = $ abc ;}}

Result:

Array ([0] => Array ([0] => 1 [1] => 2) [1] => Array ([0] => 3 [1] => 4) [2] => Array ([0] => 5 [1] => 6 ))

I hope this article will help you with php programming.

Examples in this article describes how PHP uses array_fill to define multi-dimensional arrays. Share it with you for your reference. The specific analysis is as follows...

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.