PHP Calculation, break point, and reset value in foreach loop -


How do you calculate a value (amount) + a value in the foreach loop?

I have a cricket application where I have to calculate the loop for every 6 times and then count the specific value and then the resonance resonates.

I do not have a code, but there is something like that.

And there are two values:

  1. $ balls to ball ['1']; Like arrays to 1,2,3,4,5 and 300-1000 balls
  2. Running $ balls ['6']; Arrays can be 2,3,1,5 random numbers;
  3. The value comes from the mysql table column balls and runs
foreach ($ ball $ As ball) {$ countball ++; // What do I need to know here that how do I calculate $ ball values ​​+ $ ball? // so I can resize it under the condition below? $ Run = $ ball ['run'] + $ ball ['run']; // If not working ($ countball == 6) {echo $ runs; } $ Run + = $ ball; // Reset the ball count to continue extra from the loop? // and reset} // and foreach

However this way something works fine for the first $ countball == 6. But then it does not show the exact value

You forget to reset $ countball.

You can change this part:

  if $ $ ($ countball == 6) gets run; $ Cowball = 0; }  

Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -