Table to array-php Tutorial

Source: Internet
Author: User
Table to array has the following table
Year class content
2011 Xiao Zhang physical education class badminton
Introduction to 2011 John's culture course in Europe

2011 Xiao Li physical education class football
Introduction to Xiao Li culture course in Asia 2011


2012 Xiao Zhang swimming in physical education
A brief history of 2012 Xiao Zhang culture courses

2012 Xiao Li physical education class tennis
2012 Xiao Li culture course flower appreciation
The actual table is more complex than this one. There are two year tables and two persons in the preceding table. There are two types of courses. the number of parameters in the first three columns is fixed, and the values in the content are different, that is, you can determine the fourth of the first three parameters. you need to traverse the array $ data = array [2] [2] [2]. can you do it in two dimensions? the complexity of three dimensions is too great, I don't want to enumerate the entire table into an array. Is there any way to simplify it?
Can subscript be a variable?
How can I write this array into a txt file?


Reply to discussion (solution)

$ Arr = array ('000000' => array ('Lil' => array ('physical education-badminton ', 'culture-introduction to Europe '), 'Zhang '=> array ('PE-badminton', 'culture-introduction to Europe ')), '000000' => array ('Lil' => array ('physical education-badminton ', 'culture-introduction to Europe '), 'Zhang '=> array ('PE-badminton', 'culture-introduction to Europe ')))

Thank you for choosing upstairs. could you please try to simplify the values in the array? it is best to be like a [0] [0] [0] = 5, a [0] [0] [1] = 6, a [0] [0] [2] = 8... a [3] [6] [5] = 3. a table has a total of 90 different numbers, all of which are matched by subscripts. Is there a way to traverse the table with 3*6*5, you don't need enumeration.

Generally, how many dimensions is used for such a table? The two dimensions are the clearest, but they keep repeating. There are 90 rows of 90 data records, which is huge.

Also, is the title, such as name, not usable? can I set a big label as a variable to traverse the 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.