Submerged
01-04-2006, 06:44 AM
Hi, I am creating a guitar site, which is eventually going to be extremely complicated. My question deals with a smaller part though.
My goal is to have a nested array to store all the note values at each fret for each string on the fretboard. To do this, I have a nested array like this:
$note[$stringnumber[$fretnumber]]
I have this set up correctly; If I print_r($note[1]) it comes out with the correct numbers (I have numbers, 1-12 to represent the notes. I can convert them later, I'm not worrying about it for this example).
I can read a note by assigning $temp to equal $note[$stringnumber], then calling $temp[$fretnumber]. This gives me the numeric value for the note at the given fret on the given string.
However, I am hoping there is a way to do this without an intermediary variable (the $temp), with one nice step. I don't know if this is possible, but I hope it is. I've included the php file, as dumbed down as I can get it. The part I'm asking about is at the bottom, I labelled it with comments. The 2 lines I would like to combine are:
$temp = $note[$stringnumber];
echo "Fret $fretnumber: $temp[$fretnumber]<br>";
Thanks for any help :)
-Alex
My goal is to have a nested array to store all the note values at each fret for each string on the fretboard. To do this, I have a nested array like this:
$note[$stringnumber[$fretnumber]]
I have this set up correctly; If I print_r($note[1]) it comes out with the correct numbers (I have numbers, 1-12 to represent the notes. I can convert them later, I'm not worrying about it for this example).
I can read a note by assigning $temp to equal $note[$stringnumber], then calling $temp[$fretnumber]. This gives me the numeric value for the note at the given fret on the given string.
However, I am hoping there is a way to do this without an intermediary variable (the $temp), with one nice step. I don't know if this is possible, but I hope it is. I've included the php file, as dumbed down as I can get it. The part I'm asking about is at the bottom, I labelled it with comments. The 2 lines I would like to combine are:
$temp = $note[$stringnumber];
echo "Fret $fretnumber: $temp[$fretnumber]<br>";
Thanks for any help :)
-Alex