Link to home
Create AccountLog in
Avatar of Tanabe Saori
Tanabe SaoriFlag for Japan

asked on

Variable to change loop length each time it's called.

I have two random numbers that determine how many images are shown in two columns.
$set1 = mt_rand(1,$max);
$set2 = mt_rand(1,$max);

Open in new window

I forgot how to make a modded variable to change the loop length each time it's run:
 for ($z = 1; $z <= 2; $z++){ 
for ($pieces = 1; $set.$z; $pieces++){     
      $device .= "<img src= {$direct}{$dfiles[$pieces]} alt=''/>
      ";
    }
}

Open in new window

can somebody help?
ASKER CERTIFIED SOLUTION
Avatar of skullnobrains
skullnobrains

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer