Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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