3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dv($rut) { echo strlen($rut); if(strlen($rut)==7); { echo "Rut Incorrecto \"$rut \"."; return; } $rut = strrev($rut); $aux = 1; $s = 0; for ($i = 0; $i < strlen($rut); $i++) { $aux++; $s += intval($rut[$i]) * $aux; if ($aux == 7) { $aux = 1; } } $digit = 11 - $s % 11; if ($digit == 11) { $d = 0; } elseif ($digit == 10) { $d = "K"; } else { $d = $digit; } echo "El digito verificador es \"$d\"."; return; } dv(13372223);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ghhH3
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_FCALL                                               'dv'
          1        SEND_VAL                                                 13372223
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function dv:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/ghhH3
function name:  dv
number of ops:  49
compiled vars:  !0 = $rut, !1 = $aux, !2 = $s, !3 = $i, !4 = $digit, !5 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        STRLEN                                           ~6      !0
          2        ECHO                                                     ~6
    4     3        STRLEN                                           ~7      !0
          4        IS_EQUAL                                                 ~7, 7
          5      > JMPZ                                                     ~8, ->6
    6     6    >   ROPE_INIT                                     3  ~10     'Rut+Incorrecto+%22'
          7        ROPE_ADD                                      1  ~10     ~10, !0
          8        ROPE_END                                      2  ~9      ~10, '+%22.'
          9        ECHO                                                     ~9
    7    10      > RETURN                                                   null
   10    11*       INIT_FCALL                                               'strrev'
         12*       SEND_VAR                                                 !0
         13*       DO_ICALL                                         $12     
         14*       ASSIGN                                                   !0, $12
   11    15*       ASSIGN                                                   !1, 1
   12    16*       ASSIGN                                                   !2, 0
   13    17*       ASSIGN                                                   !3, 0
         18*       JMP                                                      ->28
   14    19*       PRE_INC                                                  !1
   15    20*       FETCH_DIM_R                                      ~18     !0, !3
         21*       CAST                                          4  ~19     ~18
         22*       MUL                                              ~20     !1, ~19
         23*       ASSIGN_OP                                     1          !2, ~20
   16    24*       IS_EQUAL                                                 !1, 7
         25*       JMPZ                                                     ~22, ->27
   17    26*       ASSIGN                                                   !1, 1
   13    27*       PRE_INC                                                  !3
         28*       STRLEN                                           ~25     !0
         29*       IS_SMALLER                                               !3, ~25
         30*       JMPNZ                                                    ~26, ->19
   21    31*       MOD                                              ~27     !2, 11
         32*       SUB                                              ~28     11, ~27
         33*       ASSIGN                                                   !4, ~28
   22    34*       IS_EQUAL                                                 !4, 11
         35*       JMPZ                                                     ~30, ->38
   23    36*       ASSIGN                                                   !5, 0
         37*       JMP                                                      ->43
   24    38*       IS_EQUAL                                                 !4, 10
         39*       JMPZ                                                     ~32, ->42
   25    40*       ASSIGN                                                   !5, 'K'
         41*       JMP                                                      ->43
   27    42*       ASSIGN                                                   !5, !4
   30    43*       ROPE_INIT                                     3  ~36     'El+digito+verificador+es+%22'
         44*       ROPE_ADD                                      1  ~36     ~36, !5
         45*       ROPE_END                                      2  ~35     ~36, '%22.'
         46*       ECHO                                                     ~35
   31    47*       RETURN                                                   null
   32    48*     > RETURN                                                   null

End of function dv

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.69 ms | 1403 KiB | 16 Q