3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = '<p class="example">example</p> <p class="example" style="visibility:hidden">example</p> <script type="text/javascript">var example = 1 ....other stuff.... </script>'; $arr = explode(PHP_EOL, $str); var_dump($arr); for($i = 0; $i < count($arr); $i++){ if(strpos("hidden", $arr[$i]) === false){ unset($arr[$i]); } if(strpos("<script", $arr[$i]) === false){ while(!strpos("</script", $arr[$i]) === false){ unset($arr[$i]); $i++; } } } $str = implode(PHP_EOL, $arr); echo $str; Echo substr_count(strip_tags($str), "example");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 11
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 19
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 26, Position 2 = 37
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 27
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 41, Position 2 = 11
Branch analysis from position: 41
Branch analysis from position: 11
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 27
Branch analysis from position: 37
Branch analysis from position: 27
Branch analysis from position: 37
Branch analysis from position: 19
filename:       /in/3OpEV
function name:  (null)
number of ops:  56
compiled vars:  !0 = $str, !1 = $arr, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cp+class%3D%22example%22%3Eexample%3C%2Fp%3E%0A+++%3Cp+class%3D%22example%22+style%3D%22visibility%3Ahidden%22%3Eexample%3C%2Fp%3E%0A+++%3Cscript+type%3D%22text%2Fjavascript%22%3Evar+example+%3D+1+%0A+++....other+stuff....%0A+++%3C%2Fscript%3E'
    9     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   10     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   11     9        ASSIGN                                                   !2, 0
         10      > JMP                                                      ->38
   12    11    >   INIT_FCALL                                               'strpos'
         12        SEND_VAL                                                 'hidden'
         13        FETCH_DIM_R                                      ~8      !1, !2
         14        SEND_VAL                                                 ~8
         15        DO_ICALL                                         $9      
         16        TYPE_CHECK                                    4          $9
         17      > JMPZ                                                     ~10, ->19
   13    18    >   UNSET_DIM                                                !1, !2
   15    19    >   INIT_FCALL                                               'strpos'
         20        SEND_VAL                                                 '%3Cscript'
         21        FETCH_DIM_R                                      ~11     !1, !2
         22        SEND_VAL                                                 ~11
         23        DO_ICALL                                         $12     
         24        TYPE_CHECK                                    4          $12
         25      > JMPZ                                                     ~13, ->37
   16    26    > > JMP                                                      ->29
   17    27    >   UNSET_DIM                                                !1, !2
   18    28        PRE_INC                                                  !2
   16    29    >   INIT_FCALL                                               'strpos'
         30        SEND_VAL                                                 '%3C%2Fscript'
         31        FETCH_DIM_R                                      ~15     !1, !2
         32        SEND_VAL                                                 ~15
         33        DO_ICALL                                         $16     
         34        BOOL_NOT                                         ~17     $16
         35        TYPE_CHECK                                    4          ~17
         36      > JMPNZ                                                    ~18, ->27
   11    37    >   PRE_INC                                                  !2
         38    >   COUNT                                            ~20     !1
         39        IS_SMALLER                                               !2, ~20
         40      > JMPNZ                                                    ~21, ->11
   22    41    >   INIT_FCALL                                               'implode'
         42        SEND_VAL                                                 '%0A'
         43        SEND_VAR                                                 !1
         44        DO_ICALL                                         $22     
         45        ASSIGN                                                   !0, $22
   23    46        ECHO                                                     !0
   24    47        INIT_FCALL                                               'substr_count'
         48        INIT_FCALL                                               'strip_tags'
         49        SEND_VAR                                                 !0
         50        DO_ICALL                                         $24     
         51        SEND_VAR                                                 $24
         52        SEND_VAL                                                 'example'
         53        DO_ICALL                                         $25     
         54        ECHO                                                     $25
         55      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.35 ms | 1400 KiB | 25 Q