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]; if ($i < strlen($pad) && preg_match("/[a-z]/i", $char)) { $shift_char = $pad[$i]; $ord_shift = ctype_upper($shift_char) ? 65 : 97; $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; } echo encrypt('thiS is a test');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/C9AVb
function name:  (null)
number of ops:  5
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  $0      
          3        ECHO                                                     $0
          4      > 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 = 46) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 46
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
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: 24
2 jumps found. (Code = 43) Position 1 = 32, Position 2 = 46
Branch analysis from position: 32
Branch analysis from position: 46
Branch analysis from position: 46
Branch analysis from position: 15
filename:       /in/C9AVb
function name:  encrypt
number of ops:  53
compiled vars:  !0 = $string, !1 = $pad, !2 = $encrypted_string, !3 = $i, !4 = $char, !5 = $shift_char, !6 = $ord_shift, !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        STRLEN                                           ~14     !1
          8        IS_SMALLER                                       ~15     !3, ~14
          9      > JMPZ_EX                                          ~15     ~15, ->15
         10    >   INIT_FCALL                                               'preg_match'
         11        SEND_VAL                                                 '%2F%5Ba-z%5D%2Fi'
         12        SEND_VAR                                                 !4
         13        DO_ICALL                                         $16     
         14        BOOL                                             ~15     $16
         15    > > JMPZ                                                     ~15, ->46
    9    16    >   FETCH_DIM_R                                      ~17     !1, !3
         17        ASSIGN                                                   !5, ~17
   10    18        INIT_FCALL                                               'ctype_upper'
         19        SEND_VAR                                                 !5
         20        DO_ICALL                                         $19     
         21      > JMPZ                                                     $19, ->24
         22    >   QM_ASSIGN                                        ~20     65
         23      > JMP                                                      ->25
         24    >   QM_ASSIGN                                        ~20     97
         25    >   ASSIGN                                                   !6, ~20
   11    26        INIT_FCALL                                               'ord'
         27        SEND_VAR                                                 !5
         28        DO_ICALL                                         $22     
         29        SUB                                              ~23     $22, !6
         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     !6, 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:
159.01 ms | 1402 KiB | 22 Q