3v4l.org

run code in 300+ PHP versions simultaneously
<?php function letter2getal ($letter) { return ord($letter) - ord('a') + 1; } function word2getal($word) { $getal = 0; for ($i = 0; $i < strlen($word); $i++) { $getal += letter2getal($word[$i]); } return $getal; } var_dump(word2getal('keuzevak')); var_dump(word2getal('markeren')); var_dump(word2getal('kansspel'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuTYC
function name:  (null)
number of ops:  19
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'word2getal'
          2        SEND_VAL                                                 'keuzevak'
          3        DO_FCALL                                      0  $0      
          4        SEND_VAR                                                 $0
          5        DO_ICALL                                                 
   13     6        INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'word2getal'
          8        SEND_VAL                                                 'markeren'
          9        DO_FCALL                                      0  $2      
         10        SEND_VAR                                                 $2
         11        DO_ICALL                                                 
   14    12        INIT_FCALL                                               'var_dump'
         13        INIT_FCALL                                               'word2getal'
         14        SEND_VAL                                                 'kansspel'
         15        DO_FCALL                                      0  $4      
         16        SEND_VAR                                                 $4
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function letter2getal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uuTYC
function name:  letter2getal
number of ops:  8
compiled vars:  !0 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
    3     1        INIT_FCALL                                               'ord'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4        SUB                                              ~2      $1, 97
          5        ADD                                              ~3      ~2, 1
          6      > RETURN                                                   ~3
    4     7*     > RETURN                                                   null

End of function letter2getal

Function word2getal:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 4
Branch analysis from position: 13
Branch analysis from position: 4
filename:       /in/uuTYC
function name:  word2getal
number of ops:  15
compiled vars:  !0 = $word, !1 = $getal, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN                                                   !1, 0
    7     2        ASSIGN                                                   !2, 0
          3      > JMP                                                      ->10
    8     4    >   INIT_FCALL                                               'letter2getal'
          5        FETCH_DIM_R                                      ~5      !0, !2
          6        SEND_VAL                                                 ~5
          7        DO_FCALL                                      0  $6      
          8        ASSIGN_OP                                     1          !1, $6
    7     9        PRE_INC                                                  !2
         10    >   STRLEN                                           ~9      !0
         11        IS_SMALLER                                               !2, ~9
         12      > JMPNZ                                                    ~10, ->4
   10    13    > > RETURN                                                   !1
   11    14*     > RETURN                                                   null

End of function word2getal

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.11 ms | 1403 KiB | 21 Q