I am trying to find the value 30.33
in a range from 0 to 40 with a 0.01 step as range(0, 40, 0.01)
using in_array()
.
All other values could be found except 30.33
and I don't know what is wrong.
This is my code:
$range = range(0, 40, 0.01);
if(in_array(30.33, $range)){
echo 'Found';
} else {
echo 'Not Found';
}
// returns 'Not Found'
I have also tried setting the third parameter of in_array
to true
but not working. Here is the code as well:
$range = range(0, 40, 0.01);
if(in_array(30.33, $range, true)){
echo 'Found';
} else {
echo 'Not Found';
}
// returns 'Not Found'
What I'm I doing wrong here?