Boy, this one is really weird. I expect the following code to print 1990, but it prints 1989!
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
$val = intval($val * 100);
echo $val;
Why on earth is this happening?
Edit: and this code:
$val = '$19.9';
$val = preg_replace('/[^\d.]/','',$val);
echo $val . "<br>";
$val = $val * 100;
echo $val . "<br>";
$val = intval($val);
echo $val;
Prints:
19.9
1990
1989
Why does intval(1990)
equal 1989
???
intval('1990')
gives me 1990. I'll try to check your case out. In the while, please try to give a more relevant title to your question.intval('1990')
gives 1990, what I'm saying is that the example suggests indirectly thatintval(1990)
equals1989