3v4l.org

run code in 300+ PHP versions simultaneously
<?php function modulo($number, $modulus) { return bcsub($number, bcmul(bcdiv($number, $modulus, 0), $modulus)); } bcscale(1); var_dump(modulo("3.5", "4")); // 3.5 var_dump(modulo("1071", "357.5")); // 356
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nLMC4
function name:  (null)
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL_BY_NAME                                       'bcscale'
          1        SEND_VAL_EX                                              1
          2        DO_FCALL                                      0          
    9     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'modulo'
          5        SEND_VAL                                                 '3.5'
          6        SEND_VAL                                                 '4'
          7        DO_FCALL                                      0  $1      
          8        SEND_VAR                                                 $1
          9        DO_ICALL                                                 
   10    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'modulo'
         12        SEND_VAL                                                 '1071'
         13        SEND_VAL                                                 '357.5'
         14        DO_FCALL                                      0  $3      
         15        SEND_VAR                                                 $3
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

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

End of function modulo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.38 ms | 1390 KiB | 17 Q