I am getting started with php, and I was wondering if it was possible to explode a string into an array with named variables. The set up is that I have some data I am reading in from a text file, and I want to break it up into rows first and then break it up into individual pieces of data.
Data1 | Data2 | Data3 |
----------------------------
| x | y | z |
| p | q | r |
So I am trying to end up with something like:
data {
row1 {
data1: x
data2: y
data3: z
row2 {
data1: p
data2: q
data3: r
}
}
and I would like be able to access the data using the names of the variables if possible:
$r1d1 = data[row1]['data1'];