3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div class="items"> <div class="item" title="Checking for bad parsing. height:666px; width:666px;" style="width:295px; height:210px; border:1px solid #000;"></div> <div></div> <div class="item" style="line-height:14pt; border:1px solid #000; height :420px; width: 590px;"></div> </div> HTML; $dom = new DOMDocument; $dom->loadHTML($html); $xpath = new DOMXpath($dom); foreach ($xpath->query('//div[@class="item"]/@style') as $node) { $style = $node->nodeValue; echo "The height integer: " , preg_match('~(?:^|;)\s*height\s*:\s*\K\d+~', $style, $h) ? $h[0] : ''; echo "\n"; echo "The width integer: " , preg_match('~(?:^|;)\s*width\s*:\s*\K\d+~', $style, $w) ? $w[0] : ''; echo "\n---\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 45
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 45
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 42
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 41
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 41
Branch analysis from position: 38
Branch analysis from position: 41
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 45
filename:       /in/dGRfb
function name:  (null)
number of ops:  47
compiled vars:  !0 = $html, !1 = $dom, !2 = $xpath, !3 = $node, !4 = $style, !5 = $h, !6 = $w
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22items%22%3E%0A++++%3Cdiv+class%3D%22item%22+title%3D%22Checking+for+bad+parsing.+height%3A666px%3B+width%3A666px%3B%22+style%3D%22width%3A295px%3B+height%3A210px%3B+border%3A1px+solid+%23000%3B%22%3E%3C%2Fdiv%3E%0A++++%3Cdiv%3E%3C%2Fdiv%3E%0A++++%3Cdiv+class%3D%22item%22+style%3D%22line-height%3A14pt%3B+border%3A1px+solid+%23000%3B+height+%3A420px%3B+width%3A+590px%3B%22%3E%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   10     1        NEW                                              $8      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $8
   11     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   12     7        NEW                                              $12     'DOMXpath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $12
   13    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40class%3D%22item%22%5D%2F%40style'
         13        DO_FCALL                                      0  $15     
         14      > FE_RESET_R                                       $16     $15, ->45
         15    > > FE_FETCH_R                                               $16, !3, ->45
   14    16    >   FETCH_OBJ_R                                      ~17     !3, 'nodeValue'
         17        ASSIGN                                                   !4, ~17
   15    18        ECHO                                                     'The+height+integer%3A+'
         19        INIT_FCALL                                               'preg_match'
         20        SEND_VAL                                                 '%7E%28%3F%3A%5E%7C%3B%29%5Cs%2Aheight%5Cs%2A%3A%5Cs%2A%5CK%5Cd%2B%7E'
         21        SEND_VAR                                                 !4
         22        SEND_REF                                                 !5
         23        DO_ICALL                                         $19     
         24      > JMPZ                                                     $19, ->28
         25    >   FETCH_DIM_R                                      ~20     !5, 0
         26        QM_ASSIGN                                        ~21     ~20
         27      > JMP                                                      ->29
         28    >   QM_ASSIGN                                        ~21     ''
         29    >   ECHO                                                     ~21
   16    30        ECHO                                                     '%0A'
   17    31        ECHO                                                     'The+width+integer%3A+'
         32        INIT_FCALL                                               'preg_match'
         33        SEND_VAL                                                 '%7E%28%3F%3A%5E%7C%3B%29%5Cs%2Awidth%5Cs%2A%3A%5Cs%2A%5CK%5Cd%2B%7E'
         34        SEND_VAR                                                 !4
         35        SEND_REF                                                 !6
         36        DO_ICALL                                         $22     
         37      > JMPZ                                                     $22, ->41
         38    >   FETCH_DIM_R                                      ~23     !6, 0
         39        QM_ASSIGN                                        ~24     ~23
         40      > JMP                                                      ->42
         41    >   QM_ASSIGN                                        ~24     ''
         42    >   ECHO                                                     ~24
   18    43        ECHO                                                     '%0A---%0A'
   13    44      > JMP                                                      ->15
         45    >   FE_FREE                                                  $16
   19    46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.02 ms | 1003 KiB | 14 Q