3v4l.org

run code in 300+ PHP versions simultaneously
<?php function encrypt($string) { $pad = 'abcde'; $encrypted_string = ""; for ($i = 0; $i < strlen($string); $i++) { $char = $string[$i]; $ord_shift = ctype_upper($shift_char) ? 65 : 97; if ($i < strlen($pad) && preg_match("/[a-z]/i", $char)) { $shift_char = $pad[$i]; $shift_amount = ord($shift_char) - $ord_shift; if ($shift_amount) { $ord_char = ord($char) + $shift_amount; while ($ord_char > $ord_shift + 26) { $ord_char -= 26; } $char = chr($ord_char); } } $encrypted_string .= $char; } return $encrypted_string; } encrypt('this is a test');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YoLVf
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'encrypt'
          1        SEND_VAL                                                 'this+is+a+test'
          2        DO_FCALL                                      0          
          3      > RETURN                                                   1

Function encrypt:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 5
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 46
Branch analysis from position: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 46
Branch analysis from position: 32
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 38
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 5
Branch analysis from position: 51
Branch analysis from position: 5
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 38
Branch analysis from position: 42
Branch analysis from position: 38
Branch analysis from position: 46
Branch analysis from position: 46
Branch analysis from position: 23
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
Branch analysis from position: 23
filename:       /in/YoLVf
function name:  encrypt
number of ops:  53
compiled vars:  !0 = $string, !1 = $pad, !2 = $encrypted_string, !3 = $i, !4 = $char, !5 = $ord_shift, !6 = $shift_char, !7 = $shift_amount, !8 = $ord_char
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !1, 'abcde'
    5     2        ASSIGN                                                   !2, ''
    6     3        ASSIGN                                                   !3, 0
          4      > JMP                                                      ->48
    7     5    >   FETCH_DIM_R                                      ~12     !0, !3
          6        ASSIGN                                                   !4, ~12
    8     7        INIT_FCALL                                               'ctype_upper'
          8        SEND_VAR                                                 !6
          9        DO_ICALL                                         $14     
         10      > JMPZ                                                     $14, ->13
         11    >   QM_ASSIGN                                        ~15     65
         12      > JMP                                                      ->14
         13    >   QM_ASSIGN                                        ~15     97
         14    >   ASSIGN                                                   !5, ~15
    9    15        STRLEN                                           ~17     !1
         16        IS_SMALLER                                       ~18     !3, ~17
         17      > JMPZ_EX                                          ~18     ~18, ->23
         18    >   INIT_FCALL                                               'preg_match'
         19        SEND_VAL                                                 '%2F%5Ba-z%5D%2Fi'
         20        SEND_VAR                                                 !4
         21        DO_ICALL                                         $19     
         22        BOOL                                             ~18     $19
         23    > > JMPZ                                                     ~18, ->46
   10    24    >   FETCH_DIM_R                                      ~20     !1, !3
         25        ASSIGN                                                   !6, ~20
   11    26        INIT_FCALL                                               'ord'
         27        SEND_VAR                                                 !6
         28        DO_ICALL                                         $22     
         29        SUB                                              ~23     $22, !5
         30        ASSIGN                                                   !7, ~23
   13    31      > JMPZ                                                     !7, ->46
   14    32    >   INIT_FCALL                                               'ord'
         33        SEND_VAR                                                 !4
         34        DO_ICALL                                         $25     
         35        ADD                                              ~26     $25, !7
         36        ASSIGN                                                   !8, ~26
   16    37      > JMP                                                      ->39
   17    38    >   ASSIGN_OP                                     2          !8, 26
   16    39    >   ADD                                              ~29     !5, 26
         40        IS_SMALLER                                               ~29, !8
         41      > JMPNZ                                                    ~30, ->38
   20    42    >   INIT_FCALL                                               'chr'
         43        SEND_VAR                                                 !8
         44        DO_ICALL                                         $31     
         45        ASSIGN                                                   !4, $31
   24    46    >   ASSIGN_OP                                     8          !2, !4
    6    47        PRE_INC                                                  !3
         48    >   STRLEN                                           ~35     !0
         49        IS_SMALLER                                               !3, ~35
         50      > JMPNZ                                                    ~36, ->5
   26    51    > > RETURN                                                   !2
   27    52*     > RETURN                                                   null

End of function encrypt

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.19 ms | 1402 KiB | 22 Q