Hey I'm working on a simple program that will take user input from a HTTP form and use that to calculate a few things. I a few problems with my counter and I was wandering if anyone could point out something that could be causing my problem?
Also if anyone know how to properly get a count on the positive even int's???
This is what I'm working with.
$count = 0; $PosCount = 0; $uname = array($uname1, $uname2, $uname3, $uname4, $uname5, $uname6, $uname7, $uname8); for ($i; $i < count($uname); ++$i) { if ($uname[$i] == '0' || $uname[$i] == null) { //look to see weather its good or bad unset ($uname[$i]); //break that empty field $count = ($count - 1); } $count = $count + 1; if ($uname[$i] % 2 == 0 ) {//Even check $i = $uname[$i]; if ($i == round($i) || $i < 1) { //Pos Check $PosCount = $PosCount + 1; } } }
than of course echoing all my desired values (sum, avg, max, min, and pos int count)
- Thanks