Jump to content

[SOLVED] for statements


MemphiS

Recommended Posts

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 :)

Link to comment
https://forums.phpfreaks.com/topic/58690-solved-for-statements/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.