3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<div class="classA"> <a id="someID1"></a> <div class="class1"> <div class="class2"> <div class="class3"> <div class="class4"> <h4>name, name<small>string</small></h4> </div> <div> <h4>number<small>string</small></h4> </div> </div> </div> </div> </div> <div class="classA"> <a id="someID2"></a> <div class="class1"> <div class="class2"> <div class="class3"> <div class="class4"> <h4>nameA,nameA<small>stringA</small></h4> </div> <div> <h4>numberA<small>stringB</small></h4> </div> </div> </div> </div> </div>'; $doc = new DOMDocument(); $doc->loadHTML($html); $xpath = new DOMXpath($doc); $nodes = $xpath->query("//div[@class='classA' and a[@id='someID2']]")->item(0)->getElementsByTagName("h4"); echo $nodes->item(0)->nodeValue;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KmF2Q
function name:  (null)
number of ops:  27
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath, !3 = $nodes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22classA%22%3E%0A++++%3Ca+id%3D%22someID1%22%3E%3C%2Fa%3E%0A++++%3Cdiv+class%3D%22class1%22%3E%0A++++%3Cdiv+class%3D%22class2%22%3E%0A++++++++%3Cdiv+class%3D%22class3%22%3E%0A++++++++++++%3Cdiv+class%3D%22class4%22%3E%0A++++++++++++++++%3Ch4%3Ename%2C+name%3Csmall%3Estring%3C%2Fsmall%3E%3C%2Fh4%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++++++%3Cdiv%3E%0A++++++++++++++++%3Ch4%3Enumber%3Csmall%3Estring%3C%2Fsmall%3E%3C%2Fh4%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++%3C%2Fdiv%3E%0A++++%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%3C%2Fdiv%3E%0A%3Cdiv+class%3D%22classA%22%3E%0A++++%3Ca+id%3D%22someID2%22%3E%3C%2Fa%3E%0A++++%3Cdiv+class%3D%22class1%22%3E%0A++++++++%3Cdiv+class%3D%22class2%22%3E%0A++++++++++++%3Cdiv+class%3D%22class3%22%3E%0A++++++++++++++++%3Cdiv+class%3D%22class4%22%3E%0A++++++++++++++++++++%3Ch4%3EnameA%2CnameA%3Csmall%3EstringA%3C%2Fsmall%3E%3C%2Fh4%3E%0A++++++++++++++++%3C%2Fdiv%3E%0A++++++++++++++++%3Cdiv%3E%0A++++++++++++++++++++%3Ch4%3EnumberA%3Csmall%3EstringB%3C%2Fsmall%3E%3C%2Fh4%3E%0A++++++++++++++++%3C%2Fdiv%3E%0A++++++++++++%3C%2Fdiv%3E%0A++++++++%3C%2Fdiv%3E%0A++++%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   33     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   34     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   35     7        NEW                                              $9      'DOMXpath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   36    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fdiv%5B%40class%3D%27classA%27+and+a%5B%40id%3D%27someID2%27%5D%5D'
         13        DO_FCALL                                      0  $12     
         14        INIT_METHOD_CALL                                         $12, 'item'
         15        SEND_VAL_EX                                              0
         16        DO_FCALL                                      0  $13     
         17        INIT_METHOD_CALL                                         $13, 'getElementsByTagName'
         18        SEND_VAL_EX                                              'h4'
         19        DO_FCALL                                      0  $14     
         20        ASSIGN                                                   !3, $14
   38    21        INIT_METHOD_CALL                                         !3, 'item'
         22        SEND_VAL_EX                                              0
         23        DO_FCALL                                      0  $16     
         24        FETCH_OBJ_R                                      ~17     $16, 'nodeValue'
         25        ECHO                                                     ~17
   39    26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.37 ms | 1435 KiB | 13 Q