3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pagetext = 'Here\'s some text and stuff what is your favorite color? @OTHER["favorite color"] Whats your favorite food? @OTHER["favorite food"]'; $c = 0; while(strpos($pagetext, "@OTHER[") !== false){ $start = strpos($pagetext, '@OTHER["') + 8; $stop = strpos($pagetext, '"]', $start); $label = substr($pagetext, $start, $stop-$start); $pagetext = str_replace('@OTHER["'.$label.'"]','<input type="text" name="otherlabel'.$c.'" value="'.$label.'" /><input type="text" name="otherfield'.$c.'"><br /><small><i>'.$label.'</i></small>',$pagetext); $c++; } echo $pagetext;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 3
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 3
Branch analysis from position: 45
Branch analysis from position: 3
filename:       /in/1RQ06
function name:  (null)
number of ops:  47
compiled vars:  !0 = $pagetext, !1 = $c, !2 = $start, !3 = $stop, !4 = $label
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, 'Here%27s+some+text+and+stuff%0Awhat+is+your+favorite+color%3F%0A%40OTHER%5B%22favorite+color%22%5D%0AWhats+your+favorite+food%3F%0A%40OTHER%5B%22favorite+food%22%5D'
    7     1        ASSIGN                                                   !1, 0
    8     2      > JMP                                                      ->39
    9     3    >   INIT_FCALL                                               'strpos'
          4        SEND_VAR                                                 !0
          5        SEND_VAL                                                 '%40OTHER%5B%22'
          6        DO_ICALL                                         $7      
          7        ADD                                              ~8      $7, 8
          8        ASSIGN                                                   !2, ~8
   10     9        INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 '%22%5D'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !3, $10
   11    15        INIT_FCALL                                               'substr'
         16        SEND_VAR                                                 !0
         17        SEND_VAR                                                 !2
         18        SUB                                              ~12     !3, !2
         19        SEND_VAL                                                 ~12
         20        DO_ICALL                                         $13     
         21        ASSIGN                                                   !4, $13
   12    22        INIT_FCALL                                               'str_replace'
         23        CONCAT                                           ~15     '%40OTHER%5B%22', !4
         24        CONCAT                                           ~16     ~15, '%22%5D'
         25        SEND_VAL                                                 ~16
         26        CONCAT                                           ~17     '%3Cinput+type%3D%22text%22+name%3D%22otherlabel', !1
         27        CONCAT                                           ~18     ~17, '%22+value%3D%22'
         28        CONCAT                                           ~19     ~18, !4
         29        CONCAT                                           ~20     ~19, '%22+%2F%3E%3Cinput+type%3D%22text%22+name%3D%22otherfield'
         30        CONCAT                                           ~21     ~20, !1
         31        CONCAT                                           ~22     ~21, '%22%3E%3Cbr+%2F%3E%3Csmall%3E%3Ci%3E'
         32        CONCAT                                           ~23     ~22, !4
         33        CONCAT                                           ~24     ~23, '%3C%2Fi%3E%3C%2Fsmall%3E'
         34        SEND_VAL                                                 ~24
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $25     
         37        ASSIGN                                                   !0, $25
   13    38        PRE_INC                                                  !1
    8    39    >   INIT_FCALL                                               'strpos'
         40        SEND_VAR                                                 !0
         41        SEND_VAL                                                 '%40OTHER%5B'
         42        DO_ICALL                                         $28     
         43        TYPE_CHECK                                  1018          $28
         44      > JMPNZ                                                    ~29, ->3
   16    45    >   ECHO                                                     !0
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.53 ms | 1406 KiB | 19 Q