3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<EOF <div> <a href="#">1</a> <a href="test">2</a> </div> EOF; $doc = new DOMDocument(); $doc->loadHTML($html); $selector = new DOMXPath($doc); foreach($selector->query("//a[.='#']") as $node) { var_dump($node->nodeValue); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
2 jumps found. (Code = 78) Position 1 = 16, Position 2 = 21
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/39iRA
function name:  (null)
number of ops:  23
compiled vars:  !0 = $html, !1 = $doc, !2 = $selector, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv%3E%0A++%3Ca+href%3D%22%23%22%3E1%3C%2Fa%3E%0A++%3Ca+href%3D%22test%22%3E2%3C%2Fa%3E%0A%3C%2Fdiv%3E'
   10     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   11     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   13     7        NEW                                              $9      'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $9
   15    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fa%5B.%3D%27%23%27%5D'
         13        DO_FCALL                                      0  $12     
         14      > FE_RESET_R                                       $13     $12, ->21
         15    > > FE_FETCH_R                                               $13, !3, ->21
   16    16    >   INIT_FCALL                                               'var_dump'
         17        FETCH_OBJ_R                                      ~14     !3, 'nodeValue'
         18        SEND_VAL                                                 ~14
         19        DO_ICALL                                                 
   15    20      > JMP                                                      ->15
         21    >   FE_FREE                                                  $13
   17    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152 ms | 1395 KiB | 15 Q