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?
PHP

Avatar of undefined
Last Comment
skullnobrains
ASKER CERTIFIED SOLUTION
Avatar of skullnobrains
skullnobrains

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
PHP
PHP

PHP is a widely-used server-side scripting language especially suited for web development, powering tens of millions of sites from Facebook to personal WordPress blogs. PHP is often paired with the MySQL relational database, but includes support for most other mainstream databases. By utilizing different Server APIs, PHP can work on many different web servers as a server-side scripting language.

125K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo