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($arr[$i], "hidden") !== false){ unset($arr[$i]); } if(strpos($arr[$i], "<script") !== false){ while(strpos($arr[$i], "</script") === 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 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 8
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 16
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 33
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 8
Branch analysis from position: 37
Branch analysis from position: 8
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 24
Branch analysis from position: 33
Branch analysis from position: 24
Branch analysis from position: 33
Branch analysis from position: 16
filename:       /in/SbJlh
function name:  (null)
number of ops:  52
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
   11     6        ASSIGN                                                   !2, 0
          7      > JMP                                                      ->34
   13     8    >   INIT_FCALL                                               'strpos'
          9        FETCH_DIM_R                                      ~7      !1, !2
         10        SEND_VAL                                                 ~7
         11        SEND_VAL                                                 'hidden'
         12        DO_ICALL                                         $8      
         13        TYPE_CHECK                                  1018          $8
         14      > JMPZ                                                     ~9, ->16
   14    15    >   UNSET_DIM                                                !1, !2
   16    16    >   INIT_FCALL                                               'strpos'
         17        FETCH_DIM_R                                      ~10     !1, !2
         18        SEND_VAL                                                 ~10
         19        SEND_VAL                                                 '%3Cscript'
         20        DO_ICALL                                         $11     
         21        TYPE_CHECK                                  1018          $11
         22      > JMPZ                                                     ~12, ->33
   17    23    > > JMP                                                      ->26
   18    24    >   UNSET_DIM                                                !1, !2
   19    25        PRE_INC                                                  !2
   17    26    >   INIT_FCALL                                               'strpos'
         27        FETCH_DIM_R                                      ~14     !1, !2
         28        SEND_VAL                                                 ~14
         29        SEND_VAL                                                 '%3C%2Fscript'
         30        DO_ICALL                                         $15     
         31        TYPE_CHECK                                    4          $15
         32      > JMPNZ                                                    ~16, ->24
   11    33    >   PRE_INC                                                  !2
         34    >   COUNT                                            ~18     !1
         35        IS_SMALLER                                               !2, ~18
         36      > JMPNZ                                                    ~19, ->8
   23    37    >   INIT_FCALL                                               'implode'
         38        SEND_VAL                                                 '%0A'
         39        SEND_VAR                                                 !1
         40        DO_ICALL                                         $20     
         41        ASSIGN                                                   !0, $20
   24    42        ECHO                                                     !0
   25    43        INIT_FCALL                                               'substr_count'
         44        INIT_FCALL                                               'strip_tags'
         45        SEND_VAR                                                 !0
         46        DO_ICALL                                         $22     
         47        SEND_VAR                                                 $22
         48        SEND_VAL                                                 'example'
         49        DO_ICALL                                         $23     
         50        ECHO                                                     $23
         51      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.57 ms | 1400 KiB | 23 Q