3v4l.org

run code in 300+ PHP versions simultaneously
<?php function Kmod($bn, $sn) { return intval(fmod(floatval($bn), $sn)); } //整数取余方法 function mod($bn, $sn) { return $bn%$sn; } //最大的int整数 $bn = PHP_INT_MAX; $sn = 11; var_dump($bn); var_dump(Kmod($bn, $sn)); var_dump(mod($bn, $sn)); //给最大的int整数加1 当给最大的整型数加1之后,得到的$bn已经变为了浮点型。 $bn = PHP_INT_MAX + 1; var_dump($bn); var_dump(Kmod($bn, $sn)); var_dump(mod($bn, $sn));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q8vEm
function name:  (null)
number of ops:  38
compiled vars:  !0 = $bn, !1 = $sn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, 9223372036854775807
   14     1        ASSIGN                                                   !1, 11
   16     2        INIT_FCALL                                               'var_dump'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   17     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'kmod'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !1
          9        DO_FCALL                                      0  $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                                 
   18    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'mod'
         14        SEND_VAR                                                 !0
         15        SEND_VAR                                                 !1
         16        DO_FCALL                                      0  $7      
         17        SEND_VAR                                                 $7
         18        DO_ICALL                                                 
   21    19        ASSIGN                                                   !0, 9.22337e+18
   22    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   23    23        INIT_FCALL                                               'var_dump'
         24        INIT_FCALL                                               'kmod'
         25        SEND_VAR                                                 !0
         26        SEND_VAR                                                 !1
         27        DO_FCALL                                      0  $11     
         28        SEND_VAR                                                 $11
         29        DO_ICALL                                                 
   24    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'mod'
         32        SEND_VAR                                                 !0
         33        SEND_VAR                                                 !1
         34        DO_FCALL                                      0  $13     
         35        SEND_VAR                                                 $13
         36        DO_ICALL                                                 
         37      > RETURN                                                   1

Function kmod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q8vEm
function name:  Kmod
number of ops:  10
compiled vars:  !0 = $bn, !1 = $sn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        INIT_FCALL                                               'fmod'
          3        CAST                                          5  ~2      !0
          4        SEND_VAL                                                 ~2
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $3      
          7        CAST                                          4  ~4      $3
          8      > RETURN                                                   ~4
    5     9*     > RETURN                                                   null

End of function kmod

Function mod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Q8vEm
function name:  mod
number of ops:  5
compiled vars:  !0 = $bn, !1 = $sn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        MOD                                              ~2      !0, !1
          3      > RETURN                                                   ~2
   10     4*     > RETURN                                                   null

End of function mod

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.39 ms | 1402 KiB | 21 Q