3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = "<div class='room'> <h1>This is a h1</h1> <p>This is a Paragraph</p> <h2>This is h2</h2> </div>"; $arr = explode(PHP_EOL, $str); $res =array(); Foreach($arr as $row){ If(!strpos($row, "div") !== False){ $res[substr($row, 1, strpos($row, ">")-1)] = strip_tags($row); } } Var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 32
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 32
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 31
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 31
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
filename:       /in/8TkIT
function name:  (null)
number of ops:  37
compiled vars:  !0 = $str, !1 = $arr, !2 = $res, !3 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%27room%27%3E%0A%3Ch1%3EThis+is+a+h1%3C%2Fh1%3E%0A%3Cp%3EThis+is+a+Paragraph%3C%2Fp%3E%0A%3Ch2%3EThis+is+h2%3C%2Fh2%3E%0A%3C%2Fdiv%3E'
    9     1        INIT_FCALL                                               'explode'
          2        SEND_VAL                                                 '%0A'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   11     6        ASSIGN                                                   !2, <array>
   12     7      > FE_RESET_R                                       $8      !1, ->32
          8    > > FE_FETCH_R                                               $8, !3, ->32
   13     9    >   INIT_FCALL                                               'strpos'
         10        SEND_VAR                                                 !3
         11        SEND_VAL                                                 'div'
         12        DO_ICALL                                         $9      
         13        BOOL_NOT                                         ~10     $9
         14        TYPE_CHECK                                  1018          ~10
         15      > JMPZ                                                     ~11, ->31
   14    16    >   INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !3
         18        SEND_VAL                                                 1
         19        INIT_FCALL                                               'strpos'
         20        SEND_VAR                                                 !3
         21        SEND_VAL                                                 '%3E'
         22        DO_ICALL                                         $12     
         23        SUB                                              ~13     $12, 1
         24        SEND_VAL                                                 ~13
         25        DO_ICALL                                         $14     
         26        INIT_FCALL                                               'strip_tags'
         27        SEND_VAR                                                 !3
         28        DO_ICALL                                         $16     
         29        ASSIGN_DIM                                               !2, $14
         30        OP_DATA                                                  $16
   12    31    > > JMP                                                      ->8
         32    >   FE_FREE                                                  $8
   18    33        INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !2
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
204.28 ms | 1003 KiB | 18 Q