MemphiS Posted July 6, 2007 Share Posted July 6, 2007 i have two values i wish to use in the one for(); Ill make an example below which will make it easier to understand what im trying to do. <?php $value1 = 100; $value2 = 100; for ($i=0;$i<???;$i++){ $value1 = $value1 - rand(0,10); $value2 = $value2 - rand(0,10); echo("Value1 is now $value1, And Value2 is now $value2"); if ($value1 < 0){ ???=1; } if ($value2 < 0){ ???=1; } } The question marks (???) is the section that im not sure how to do... As i have two values that are 100 but $value1 or $value2 will reach 0 first and i wish it to stop once either have become 0. Thanks for your responces Quote Link to comment Share on other sites More sharing options...
MemphiS Posted July 6, 2007 Author Share Posted July 6, 2007 Nevermind worked it out myself if any that reads was interested in how.. I added a $holdValue = 100; and calculated which of $value1 or $value2 was greater and - it from the $holdValue Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.