0

I used the following code to print the sum of two integer numbers with underflow:

        $z10 = (int)($z & 0xFFFFFFFF);
        $z11 = (int)($z5 & 0xFFFFFFFF);
        $z12 = (int)(((int)$z10 + (int)$z11) & 0xFFFFFFFF);
        $z10_type =  gettype ( $z10);
        $z11_type =  gettype ( $z11);
        $z12_type =  gettype ( $z12);
        print "z10   " .dechex($z10) . "           " . $z10_type . "\n";
        print "z11   " .dechex($z11) . "           " . $z11_type .  "\n";
        print "z12   " .dechex($z12) . "           " . $z12_type .  "\n";
        $z = ((int)($z10 + $z11)) & 0xFFFFFFFF;
        print "z   " .$z . "\n";

The result with php7 and HW support int32 is:

z10   eb9c083c           integer
z11   8d833a2f           integer
z12   0           integer
z   0

The result with php 5.5 and HW support int32 is:

z10   eb9c083c           integer
z11   8d833a2f           integer
z12   791f426b           integer
z   2032091755

Any reason why I got 0 in php 7?

4

0 回答 0