$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
The above describes the everything is beautiful PHP intval test code Discovery problem, including the everything is beautiful content, I hope that the PHP tutorial interested in a friend to help.