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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.65 ms | 1020 KiB | 18 Q