Jump to content

silentfury45

New Members
  • Posts

    3
  • Joined

  • Last visited

silentfury45's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. $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; } } } Okay so I've replaced my pos even check with something similar to what you showed me but I'm still getting an error. I'll need to work on it a little more and if I'm still having problems ill post the new updated code on this thread. Thanks for the help!
  2. I'm not sure if I'm using the array the right way. When I enter text into number1field but nothing else it shows the count was 4 when it should be 1. The min sometimes doesnt show up too. Nothing shows up for my even check and pos check.Am i using the array functions correctly.?
  3. 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
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.