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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.05 ms | 1400 KiB | 23 Q