3v4l.org

run code in 300+ PHP versions simultaneously
<?php // 1744830464 - valid result [C#] // 6039797760 - wrong result [PHP] $bt = 1; $value = 3019898880; $value = gmp_shiftl($value, $bt);//$value << $bt; echo $value; function gmp_shiftl($x,$n) { // shift left return(gmp_mul($x,gmp_pow(2,$n))); } function gmp_shiftr($x,$n) { // shift right return(gmp_div($x,gmp_pow(2,$n))); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDPtP
function name:  (null)
number of ops:  9
compiled vars:  !0 = $bt, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 1
    7     1        ASSIGN                                                   !1, 3019898880
    8     2        INIT_FCALL_BY_NAME                                       'gmp_shiftl'
          3        SEND_VAR_EX                                              !1
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !1, $4
    9     7        ECHO                                                     !1
   17     8      > RETURN                                                   1

Function gmp_shiftl:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDPtP
function name:  gmp_shiftl
number of ops:  12
compiled vars:  !0 = $x, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL_BY_NAME                                       'gmp_mul'
          3        SEND_VAR_EX                                              !0
          4        INIT_FCALL_BY_NAME                                       'gmp_pow'
          5        SEND_VAL_EX                                              2
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR_NO_REF_EX                                       $2
          9        DO_FCALL                                      0  $3      
         10      > RETURN                                                   $3
   13    11*     > RETURN                                                   null

End of function gmp_shiftl

Function gmp_shiftr:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MDPtP
function name:  gmp_shiftr
number of ops:  12
compiled vars:  !0 = $x, !1 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        INIT_FCALL_BY_NAME                                       'gmp_div'
          3        SEND_VAR_EX                                              !0
          4        INIT_FCALL_BY_NAME                                       'gmp_pow'
          5        SEND_VAL_EX                                              2
          6        SEND_VAR_EX                                              !1
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR_NO_REF_EX                                       $2
          9        DO_FCALL                                      0  $3      
         10      > RETURN                                                   $3
   17    11*     > RETURN                                                   null

End of function gmp_shiftr

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.44 ms | 1008 KiB | 13 Q