Welcome Guest, Not a member yet? Register   Sign In
comparison function
#1

[eluser]Unknown[/eluser]
can someone help with a code to complete this task

need to compare a set of numbers to a given range and get a result when matched
#2

[eluser]devbro[/eluser]
can you give us an example or more details.


if you mean to filter a set of numbers based on a min/max value then this should do:

Code:
$nums = array(1,2,3,4,2,1,2312,33,4,2312);
$rc = array();//holds the result

foreach($nums as $num)
{
if($min <= $num && $num <= $max)
{
$rc[] = $num
}
}
#3

[eluser]Unknown[/eluser]
need to restructure the question

a range is reqd 1 to 10
you pick a set of nos in between the range 348
we pick another set of nos to be compared against the first one 149 and output the result 4




Theme © iAndrew 2016 - Forum software by © MyBB