CAST

PHP コード

<?php
/*
 * casts value1 as type value2 (type in extended_value)
 * opcode number: 21
 */
echo (int)1;
?>

PHP オペコード

関数名: (null)

コンパイルされた変数: none

line#op fetchextreturn operands
60 CAST  4~0 1
 1 ECHO     ~0
72 RETURN     1
add a note add a note

User Contributed Notes 1 note

up
0
fodger1975 at gmail dot com
9 years ago
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.
To Top