Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 885455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T12:54:56+00:00 2026-05-15T12:54:56+00:00

I cant get around on how to express this is PHP. I have 100

  • 0

I cant get around on how to express this is PHP.

I have 100 and 420 as my min and max value that I wish to obtain.

Than lets suppose I have:

1000
4534
34566
123145
12312265

Now, how can I say:

Take 4534 and knowing that 1000 = 420 and 12312265 = 100 determine 4534 value.

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.

Thank you.

Im still having trouble figuring this out.

So far using the code from the first answer I have:

$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 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T12:54:57+00:00Added an answer on May 15, 2026 at 12:54 pm

    This should illustrate….

    $values=array(1000, 4534, 34566, 123145, 12312265);
    $srcmin=$values[0];
    $srcmax=$values[count($values)-1];
    
    $destmin=420;
    $destmax=100;
    
    foreach($values as $x)
    {
         //how far in the source range is $x (0..1)
         $pos = (($x - $srcmin) / ($srcmax-$srcmin)) 
    
         //figure out where that puts us in the destination range
         $rescaled = ($pos * ($destmax-$destmin)) + $destmin;
    }
    

    You want to know how far through the source range each number is, that’s what the $pos value gives you. Given that, you can translate that into how far through the destination range you are.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hey, I'm learning PHP, and i cant get my head around PHP classes/objects. I
Why can't you do this and is there are work around? You get this
So this seems pretty basic but I can't get it to work. I have
I think this must be simple but I can't get it right... I have
I started learning XML yesterday but I cant get around the concept of DTD.
I've been playing around with the Windows api for uni, but I cant get
This sounds dumb, but I can't get it to work. I think i just
I'm having trouble with something that I thought would be easy... I can't get
Can't get to my site. Apache gives the following error message: [Fri Sep 05
I can't get my GridView to enable a user to sort a column of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.