$o = 0.1;
for ($a = 1; $a < $a + +) {
$o + = 0.1;
echo "
Intval (' $o ') = ". Intval ($o);
if (Intval ($o)) {
Print ("true");
}else{
Print ("false");
}
}
?>
Results:
Intval (' 0.2 ') = 0 false
Intval (' 0.3 ') = 0 false
Intval (' 0.4 ') = 0 false
Intval (' 0.5 ') = 0 false
Intval (' 0.6 ') = 0 false
Intval (' 0.7 ') = 0 false
Intval (' 0.8 ') = 0 false
Intval (' 0.9 ') = 0 false
Intval (' 1 ') = 0 false
Intval (' 1.1 ') = 1 true
Intval (' 1.2 ') = 1 true
Intval (' 1.3 ') = 1 true
Intval (' 1.4 ') = 1 true
Intval (' 1.5 ') = 1 true
Intval (' 1.6 ') = 1 true
Intval (' 1.7 ') = 1 true
Intval (' 1.8 ') = 1 true
Intval (' 1.9 ') = 1 true
Intval (' 2 ') = 2 true
Intval (' 2.1 ') = 2 true
Intval (' 2.2 ') = 2 true
Intval (' 2.3 ') = 2 true
Intval (' 2.4 ') = 2 true
Intval (' 2.5 ') = 2 true
Intval (' 2.6 ') = 2 true
Intval (' 2.7 ') = 2 true
Intval (' 2.8 ') = 2 true
.....
found that intval (1) actually returned 0
Not testing, not knowing.
Illusion:
Print ("
Intval (\ "1.0\") = ". Intval (" 1.0 "));
Print ("
Intval (' 1.0 ') = ". Intval (' 1.0 '));
Print ("
Intval (' 1 ') = ". Intval (' 1 '));
Intval ("1.0") = 1
Intval (' 1.0 ') = 1
Intval (' 1 ') = 1
http://www.bkjia.com/PHPjc/319364.html www.bkjia.com true http://www.bkjia.com/PHPjc/319364.html techarticle php $o =0.1; for ($a =1; $a; $a + +) {$o +=0.1; echo "Br/intval (' $o ') =". Intval ($o); if (Intval ($o)) {print ("true");} else{print ("false");}} ? Result: intval (' 0.2 ') =0false intval (' 0.3 ' ...