PHP Function for get result between two number by entered parameter

I’m thinking about how to write a function for getting a result dependent on a specific range.

See my code:

function($number){
    if($number < 10){
        return 0;
    }else if($number>=10 && $number < 200){
        return customrange($number,10,200,0,200);
    }else if($number>=200 && $number < 1000){
        return customrange($number,200,1000,200,500);
    }else if($number>=1000 && $number < 3000){
        return customrange($number,1000,3000,500,800);
    }
}
function customrange($number,$min,$max,$minResult,$maxResult){
    return '????';
}

I need to fill customrange function for my code to be work but I haven’t any idea.

result of customrange function will be between $minResult and $maxResult parameter depending on how much $number is near to $min and $max

Examples:

customrange(10,10,200,0,200); // Result: 0;
customrange(105,10,200,0,200); // Result: 100;
customrange(200,10,200,0,200); // Result: 200;
customrange(200,200,1000,200,500); // Result: 200;
customrange(600,200,1000,200,500); // Result: 350;
customrange(1000,200,1000,200,500); // Result: 500;
customrange(1000,1000,3000,500,800); // Result: 500;
customrange(2000,1000,3000,500,800); // Result: 650;
customrange(3000,1000,3000,500,800); // Result: 800;

Thanks.