3v4l.org

run code in 300+ PHP versions simultaneously
<?php function f($dividend, $divider) { $reminder = (($dividend % $divider) + abs($divider)) % abs($divider); $quotient = ($dividend - $reminder) / $divider; printf("%2d/%2d = %2d (remainder %d)\n", $dividend, $divider, $quotient, $reminder); } f(7, 3); f(7, -3); f(-7, 3); f(-7, -3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GGBti
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'f'
          1        SEND_VAL                                                 7
          2        SEND_VAL                                                 3
          3        DO_FCALL                                      0          
   13     4        INIT_FCALL                                               'f'
          5        SEND_VAL                                                 7
          6        SEND_VAL                                                 -3
          7        DO_FCALL                                      0          
   14     8        INIT_FCALL                                               'f'
          9        SEND_VAL                                                 -7
         10        SEND_VAL                                                 3
         11        DO_FCALL                                      0          
   15    12        INIT_FCALL                                               'f'
         13        SEND_VAL                                                 -7
         14        SEND_VAL                                                 -3
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GGBti
function name:  f
number of ops:  23
compiled vars:  !0 = $dividend, !1 = $divider, !2 = $reminder, !3 = $quotient
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        MOD                                              ~4      !0, !1
          3        INIT_FCALL                                               'abs'
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $5      
          6        ADD                                              ~6      ~4, $5
          7        INIT_FCALL                                               'abs'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        MOD                                              ~8      ~6, $7
         11        ASSIGN                                                   !2, ~8
    6    12        SUB                                              ~10     !0, !2
         13        DIV                                              ~11     ~10, !1
         14        ASSIGN                                                   !3, ~11
    8    15        INIT_FCALL                                               'printf'
         16        SEND_VAL                                                 '%252d%2F%252d+%3D+%252d+%28remainder+%25d%29%0A'
         17        SEND_VAR                                                 !0
         18        SEND_VAR                                                 !1
         19        SEND_VAR                                                 !3
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
    9    22      > RETURN                                                   null

End of function f

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.29 ms | 1403 KiB | 21 Q