3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fmod2($a, $b) { $div = $a / $b; return ($div - floor($div)) * $b; } var_dump([ fmod2(4.2, 1), fmod2(3.3, 4), fmod2(8.2, 6.2), ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4BReS
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'var_dump'
    9     1        INIT_FCALL                                               'fmod2'
          2        SEND_VAL                                                 4.2
          3        SEND_VAL                                                 1
          4        DO_FCALL                                      0  $0      
          5        INIT_ARRAY                                       ~1      $0
   10     6        INIT_FCALL                                               'fmod2'
          7        SEND_VAL                                                 3.3
          8        SEND_VAL                                                 4
          9        DO_FCALL                                      0  $2      
         10        ADD_ARRAY_ELEMENT                                ~1      $2
   11    11        INIT_FCALL                                               'fmod2'
         12        SEND_VAL                                                 8.2
         13        SEND_VAL                                                 6.2
         14        DO_FCALL                                      0  $3      
         15        ADD_ARRAY_ELEMENT                                ~1      $3
         16        SEND_VAL                                                 ~1
         17        DO_ICALL                                                 
   12    18      > RETURN                                                   1

Function fmod2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4BReS
function name:  fmod2
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $div
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        DIV                                              ~3      !0, !1
          3        ASSIGN                                                   !2, ~3
    5     4        INIT_FCALL                                               'floor'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $5      
          7        SUB                                              ~6      !2, $5
          8        MUL                                              ~7      !1, ~6
          9      > RETURN                                                   ~7
    6    10*     > RETURN                                                   null

End of function fmod2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
181.18 ms | 1399 KiB | 20 Q