3v4l.org

run code in 300+ PHP versions simultaneously
<?php function alter_macros($content) { preg_match_all('#{(.*)}#Ui', $content, $matches); for($i = 0; $i < count($matches[1]); $i++) { $ns = explode("|", $matches[1][$i]); $c2 = count($ns); $rand = rand(0, ($c2 - 1)); $content = str_replace("{".$matches[1][$i]."}", $ns[$rand], $content); } return $content; } function xnum_macros($content) { preg_match_all('#\[NUM\-([[:digit:]]+)\]#', $content, $matches); for($i = 0; $i < count($matches[0]); $i++) { $num = $matches[1][$i]; $min = pow(10, $num - 1); $max = pow(10, $num) - 1; $rand = rand($min, $max); $content = str_replace($matches[0][$i], $rand, $content); } return $content; } function num_macros($content) { preg_match_all('#\[RAND\-([[:digit:]]+)\-([[:digit:]]+)\]#', $content, $matches); for($i = 0; $i < count($matches[0]); $i++) { $min = $matches[1][$i]; $max = $matches[2][$i]; $rand = rand($min, $max); $content = str_replace($matches[0][$i], $rand, $content); } return $content; } function fteil_macros($content, $fteil) { return str_replace("[FTEIL]", $fteil, $content); } if(!strpos("abc.doc", ".jpg")) { $filename = alter_macros("abc.doc"); $filename = num_macros($filename); $filename = xnum_macros($filename); echo $filename; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/ug1t3
function name:  (null)
number of ops:  20
compiled vars:  !0 = $filename
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   49     0  E >   INIT_FCALL                                               'strpos'
          1        SEND_VAL                                                 'abc.doc'
          2        SEND_VAL                                                 '.jpg'
          3        DO_ICALL                                         $1      
          4        BOOL_NOT                                         ~2      $1
          5      > JMPZ                                                     ~2, ->19
   51     6    >   INIT_FCALL                                               'alter_macros'
          7        SEND_VAL                                                 'abc.doc'
          8        DO_FCALL                                      0  $3      
          9        ASSIGN                                                   !0, $3
   52    10        INIT_FCALL                                               'num_macros'
         11        SEND_VAR                                                 !0
         12        DO_FCALL                                      0  $5      
         13        ASSIGN                                                   !0, $5
   53    14        INIT_FCALL                                               'xnum_macros'
         15        SEND_VAR                                                 !0
         16        DO_FCALL                                      0  $7      
         17        ASSIGN                                                   !0, $7
   54    18        ECHO                                                     !0
   55    19    > > RETURN                                                   1

Function alter_macros:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 8
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 39, Position 2 = 8
Branch analysis from position: 39
Branch analysis from position: 8
filename:       /in/ug1t3
function name:  alter_macros
number of ops:  41
compiled vars:  !0 = $content, !1 = $matches, !2 = $i, !3 = $ns, !4 = $c2, !5 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%23%7B%28.%2A%29%7D%23Ui'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
    6     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->35
    8     8    >   INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%7C'
         10        FETCH_DIM_R                                      ~8      !1, 1
         11        FETCH_DIM_R                                      ~9      ~8, !2
         12        SEND_VAL                                                 ~9
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
    9    15        COUNT                                            ~12     !3
         16        ASSIGN                                                   !4, ~12
   10    17        INIT_FCALL                                               'rand'
         18        SEND_VAL                                                 0
         19        SUB                                              ~14     !4, 1
         20        SEND_VAL                                                 ~14
         21        DO_ICALL                                         $15     
         22        ASSIGN                                                   !5, $15
   11    23        INIT_FCALL                                               'str_replace'
         24        FETCH_DIM_R                                      ~17     !1, 1
         25        FETCH_DIM_R                                      ~18     ~17, !2
         26        CONCAT                                           ~19     '%7B', ~18
         27        CONCAT                                           ~20     ~19, '%7D'
         28        SEND_VAL                                                 ~20
         29        FETCH_DIM_R                                      ~21     !3, !5
         30        SEND_VAL                                                 ~21
   12    31        SEND_VAR                                                 !0
         32        DO_ICALL                                         $22     
   11    33        ASSIGN                                                   !0, $22
    6    34        PRE_INC                                                  !2
         35    >   FETCH_DIM_R                                      ~25     !1, 1
         36        COUNT                                            ~26     ~25
         37        IS_SMALLER                                               !2, ~26
         38      > JMPNZ                                                    ~27, ->8
   14    39    > > RETURN                                                   !0
   15    40*     > RETURN                                                   null

End of function alter_macros

Function xnum_macros:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 8
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 8
Branch analysis from position: 41
Branch analysis from position: 8
filename:       /in/ug1t3
function name:  xnum_macros
number of ops:  43
compiled vars:  !0 = $content, !1 = $matches, !2 = $i, !3 = $num, !4 = $min, !5 = $max, !6 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%23%5C%5BNUM%5C-%28%5B%5B%3Adigit%3A%5D%5D%2B%29%5C%5D%23'
          3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   20     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->37
   22     8    >   FETCH_DIM_R                                      ~9      !1, 1
          9        FETCH_DIM_R                                      ~10     ~9, !2
         10        ASSIGN                                                   !3, ~10
   23    11        INIT_FCALL                                               'pow'
         12        SEND_VAL                                                 10
         13        SUB                                              ~12     !3, 1
         14        SEND_VAL                                                 ~12
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !4, $13
   24    17        INIT_FCALL                                               'pow'
         18        SEND_VAL                                                 10
         19        SEND_VAR                                                 !3
         20        DO_ICALL                                         $15     
         21        SUB                                              ~16     $15, 1
         22        ASSIGN                                                   !5, ~16
   25    23        INIT_FCALL                                               'rand'
         24        SEND_VAR                                                 !4
         25        SEND_VAR                                                 !5
         26        DO_ICALL                                         $18     
         27        ASSIGN                                                   !6, $18
   26    28        INIT_FCALL                                               'str_replace'
         29        FETCH_DIM_R                                      ~20     !1, 0
         30        FETCH_DIM_R                                      ~21     ~20, !2
         31        SEND_VAL                                                 ~21
         32        SEND_VAR                                                 !6
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $22     
         35        ASSIGN                                                   !0, $22
   20    36        PRE_INC                                                  !2
         37    >   FETCH_DIM_R                                      ~25     !1, 0
         38        COUNT                                            ~26     ~25
         39        IS_SMALLER                                               !2, ~26
         40      > JMPNZ                                                    ~27, ->8
   28    41    > > RETURN                                                   !0
   29    42*     > RETURN                                                   null

End of function xnum_macros

Function num_macros:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 8
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 32, Position 2 = 8
Branch analysis from position: 32
Branch analysis from position: 8
filename:       /in/ug1t3
function name:  num_macros
number of ops:  34
compiled vars:  !0 = $content, !1 = $matches, !2 = $i, !3 = $min, !4 = $max, !5 = $rand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   32     1        INIT_FCALL                                               'preg_match_all'
          2        SEND_VAL                                                 '%23%5C%5BRAND%5C-%28%5B%5B%3Adigit%3A%5D%5D%2B%29%5C-%28%5B%5B%3Adigit%3A%5D%5D%2B%29%5C%5D%23'
   33     3        SEND_VAR                                                 !0
          4        SEND_REF                                                 !1
          5        DO_ICALL                                                 
   34     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->28
   36     8    >   FETCH_DIM_R                                      ~8      !1, 1
          9        FETCH_DIM_R                                      ~9      ~8, !2
         10        ASSIGN                                                   !3, ~9
   37    11        FETCH_DIM_R                                      ~11     !1, 2
         12        FETCH_DIM_R                                      ~12     ~11, !2
         13        ASSIGN                                                   !4, ~12
   38    14        INIT_FCALL                                               'rand'
         15        SEND_VAR                                                 !3
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                         $14     
         18        ASSIGN                                                   !5, $14
   39    19        INIT_FCALL                                               'str_replace'
         20        FETCH_DIM_R                                      ~16     !1, 0
         21        FETCH_DIM_R                                      ~17     ~16, !2
         22        SEND_VAL                                                 ~17
         23        SEND_VAR                                                 !5
         24        SEND_VAR                                                 !0
         25        DO_ICALL                                         $18     
         26        ASSIGN                                                   !0, $18
   34    27        PRE_INC                                                  !2
         28    >   FETCH_DIM_R                                      ~21     !1, 0
         29        COUNT                                            ~22     ~21
         30        IS_SMALLER                                               !2, ~22
         31      > JMPNZ                                                    ~23, ->8
   41    32    > > RETURN                                                   !0
   42    33*     > RETURN                                                   null

End of function num_macros

Function fteil_macros:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ug1t3
function name:  fteil_macros
number of ops:  9
compiled vars:  !0 = $content, !1 = $fteil
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   46     2        INIT_FCALL                                               'str_replace'
          3        SEND_VAL                                                 '%5BFTEIL%5D'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7      > RETURN                                                   $2
   47     8*     > RETURN                                                   null

End of function fteil_macros

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.25 ms | 1411 KiB | 28 Q