Jump to content

Help with variable


amg182

Recommended Posts

Hi guys.

 

I would like one of my varaibles ($VAR1) to have a paricular value depending on another variables value($VAR2).

 

Example would be:

 

if $VAR2 is between 0 - 9 then $VAR1 will =1

if $VAR2 is between 10 - 19 then $VAR1 will =2

if $VAR2 is between 20 - 29 then $VAR1 will =3

if $VAR2 is between 30 - 39 then $VAR1 will =3

etc....

 

As you can see it is for every VAR1 increment of 10  i would like to increase VAR2 by 1.

 

i did try:

$var1=ceil($var2 / 10);

 

But this will only work if i have values of 1-10, 10-20, 30-40 etc...

 

I hope this makes sense....

Link to comment
https://forums.phpfreaks.com/topic/246649-help-with-variable/
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.