Put simply, I need to take the first column of an array and turn that into a named array, multiple times over within a single 2d array.
$arr[0][0] = “Name”
$arr[1][0] = “Version”
…etc, allowing me to then access them as:
$arr[“Name”][1] = “Bob”
$arr[“Version”][1] = “1.00”
How do you assign variable names to an index? If that makes sense. I don’t know the proper terms for this kind of thing… Or at least not how to use them.
Anyway, the actual array looks like this:
Name,Version,Compact,OpenGFx
Element1,1.0,0,0,1
Element2,1.23,0,0,1
ElementN,1.0,0,0,1
I started writing identifiers to do the same thing ($name=0, $version=1, etc.) but there are 165 columns! So automation would be much easier, and I am interested in learning new things as always!
If I understand it right, you don’t want to be writing out all of the headings right? Maybe you could do something similar to this code:
I’ve just assumed the format of the input array, you might need to change it around a bit: