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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
196.03 ms | 1404 KiB | 23 Q