Basically I'm trying to achieve this:
// generating a random number
$randomid = rand(261, 270);
//if range is between numbers, assign strings
$verticalaa = if ($randomid >= 261 && $randomid <= 265);
$verticalbb = if ($randomid >= 266 && $randomid <= 270);
//echo the range string name
echo 'random range is in' . $verticalaa . '' . $verticalbb . '';
In the end I want to echo the name of matching range.
If the number is, let's say, 262, it would echo verticalaa.
I hope it's possible to understand what I'm after.
My head is like a balloon now after hours of coding.
Need help.
source https://stackoverflow.com/questions/69337395/how-to-do-string-ifin-range
Comments
Post a Comment