I can not get around how to express this PHP.
I have 100 and 420 as my min and max value I want to get.
What suggests:
1000 4534 34566 123145 12312265
Now, how can I say:
Take 4534 and knowing that 1000 = 420 and 12312265 = 100 determine the value of 4534.
To make this clearer, I am trying to imagine ranking web pages with squares, so if the rank is 1, it should be converted to my maximum value / size of 420, however, if the page is of low popularity, say 13000, then its size should be close to a minimum of 100. I know all the values.
Thanks.
Itโs still hard for me to understand this.
So far, using the code from the first answer, I:
$srcmin=1185; $srcmax=25791525; $destmin=100; $destmax=420; $pos = (($RANK - $srcmin) / ($srcmax-$srcmin)) ; $rescaled = ($pos * ($destmax-$destmin)) + $destmin;*/ $percentage = (($RANK - $MIN) * 100) / $MAX; $SIZE = (($percentage / 320) * 100) + 100
Being $ RANK, my values โโfor web page series and $ SIZE are the value I need for their correct size. This does not work (my mistake, no doubt) everything I get from $ SIZE is 100.
math php scale
Marvin
source share