Hi,
Take care about casting.
Casting from float doesn't seem to work properly:
print (int) (( 0.1 + 0.7 ) * 10);
Will return ... 7 ! It should be 8.
Using printf give same result.
<?php
/*
* casts value1 as type value2 (type in extended_value)
* opcode number: 21
*/
echo (int)1;
?>
関数名: (null)
コンパイルされた変数: none
line | # | op | fetch | ext | return | operands |
---|---|---|---|---|---|---|
6 | 0 | CAST | 4 | ~0 | 1 | |
1 | ECHO | ~0 | ||||
7 | 2 | RETURN | 1 |
Hi,
Take care about casting.
Casting from float doesn't seem to work properly:
print (int) (( 0.1 + 0.7 ) * 10);
Will return ... 7 ! It should be 8.
Using printf give same result.