MVC is the current buzz in web application architectures. It comes from event-driven desktop application design and doesn't fit into web application design very well. But luckily nobody really knows what MVC means, so we can call our presentation layer separation mechanism MVC and move on. (Rasmus Lerdorf)
What I want to do is assign each result in turn along with its roll number to a two dimensional array in the first for loop and print to an html table with a header row using a second program loop. Any help would be great.
That's what firepages has done there. If you want the side number and count separate, a simple division is all that's required in the print.
So like so:
What I want to do is use two separate for loops to roll a dice 26 times and assign each result in turn along with its roll number to a two dimensional array in the first for loop then count the total value of dice rolls over 26 throws and print to an html table.
Still not seeing a need to use multiple dimensions, but I don't know what you want in that output table.
You can use two arrays to simplify. The first is simply what the roll values are, and offsets will correspond to the roll value. You can then create a second array of the counts using array_count_values to pin the roll number to the count. Something like this:
So it still comes down to what you want inside that HTML. The $aRolls will contain each corresponding roll's 0 - 25 in this example, and the $aValueCounts associates the key as the value rolled with the value being the number of times it was rolled.
Use two separate for loops to roll a dice 26 times and assign each result in turn along with its roll number to a two dimensional array in the first for loop then count the total value of dice rolls over 26 throws and print to an html table with a header row using a second program loop. The total value of the dice rolls plus the average value per throw should be printed out.
Still not seeing a need for multidimensional here. Not to mention it will increase complication to the calculations since you cannot use things like count and array_sum's on the entire array as they are not recursive.
This doesn't describe very well what the structure of the array should look like. The description you have specifies a two dimensional array, but the data provided is only one dimensional since the roll corresponds to the offset of the array itself, and so can be retrieved from the key. So what is the structure of the rolled array supposed to look like?
As with the total value of the dice rolls, if that includes every value you need to increment a variable within the population of it if you are using multiple dimensions. The only alternative is to use a loop to count it as well since you cannot use count or array_sum to get this information from multiple dimensions, and this can be grouped into the second loop only if its intended to be used after the loop. If its a sum of the total number of rolls, then that can be calculated during the second loop.
Show us what the array is supposed to look like, and what the HTML table should look like.