PHP 2d array question

Posted by Neral on Stack Overflow See other posts from Stack Overflow or by Neral
Published on 2010-06-08T20:30:16Z Indexed on 2010/06/08 20:42 UTC
Read the original article Hit count: 197

Filed under:
|

Hello,

So i have a 2 dimensional array that is used over several pages (session)

            $_SESSION ["Table"][$_SESSION ["count"]] [0] = $filename;
            $_SESSION ["Table"][$_SESSION ["count"]] [1] = $size;
            $_SESSION ["Table"][$_SESSION ["count"]] [2] = $floor;
            $_SESSION ["Table"][$_SESSION ["count"]] [3] = $phone;
            $_SESSION ["Table"][$_SESSION ["count"]] [4] = $network;
            $_SESSION ["Table"][$_SESSION ["count"]] [5] = $totalprice;

This is used with a form so i can give in multiple input wich gets stored.

But my question is how exactly can i calculate the AVERAGE of $total price of all given in results?

Meaning for example i have 5 rows so this would mean 5 total prices. How exactly can i acces this value and count everything up / 5? This will happen in a other page so i would like to use sessions for this. /5 simply by count($_Session["table"]) , but really not sure about the other values.

Kind Regards.

© Stack Overflow or respective owner

Related posts about php

Related posts about beginner