title: Scaling values in PHP
body: <p>I cant get around on how to express this is PHP.</p>
  
  <p>I have 100 and 420 as my min and max value that I wish to obtain.</p>
  
  <p>Than lets suppose I have:</p>
  
  <pre><code>1000
  4534
  34566
  123145
  12312265
  </code></pre>
  
  <p>Now, how can I say:</p>
  
  <p>Take 4534 and knowing that 1000 = 420 and 12312265 = 100 determine 4534 value.</p>
  
  <p>To make it more clear, Im trying to represent web page ranks with squares, so if the rank is 1 it should be translated into my maximum value/size 420, however if the page ranks low on popularity, say 13000 then its size should be close to the minimum 100. I know all the values.</p>
  
  <p>Thank you.</p>
  
  <p>Im still having trouble figuring this out.</p>
  
  <p>So far using the code from the first answer I have:</p>
  
  <pre><code>$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
  </code></pre>
  
  <p>Being $RANK my values for the ranks of web pages and $SIZE the value that I need to size them accordingly. This does not work (my mistake no doubt)  all I get from $SIZE is 100.</p>