I have a form like this
for($x=0;$x<8;$x++){
echo "<input name='test[]'> <br>";
}
then i'm input, and i get this result
Array
(
[0] => 1
[1] => 2
[2] => 0
[3] => 0
[4] => 0
[5] =>
[6] => 0
[7] =>
)
I want to sum
then divide
it. I'm using array_sum
to sum
it. Now the problem, how can i divide
it depends on my input(s) not the many of input field(s) and i don't want count the zero as input.
so it will become something like this
(1+2) / 2
how can i achieve that? sorry for my bad english.