3v4l.org

run code in 500+ PHP versions simultaneously
<?php declare(strict_types=1); $xml = <<<XML <?xml version="1.0" encoding="utf-8" ?> <tools> <tool> <name>A</name> </tool> <tool> <name>B</name> </tool> <tool> <name>C</name> </tool> </tools> XML; $doc = new DOMDocument('1.0', 'utf-8'); $doc->loadXML($xml); $xpath = new DOMXPath($doc); foreach ($xpath->query('/tools/tool[name[text() = "B"]]') as $item) { print_r($item); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 17, Position 2 = 22
Branch analysis from position: 17
2 jumps found. (Code = 78) Position 1 = 18, Position 2 = 22
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/NL9Wd
function name:  (null)
number of ops:  24
compiled vars:  !0 = $xml, !1 = $doc, !2 = $xpath, !3 = $item
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   ASSIGN                                                       !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22+%3F%3E%0A%3Ctools%3E%0A++++%3Ctool%3E%0A++++++++%3Cname%3EA%3C%2Fname%3E%0A++++%3C%2Ftool%3E%0A++++%0A++++%3Ctool%3E%0A++++++++%3Cname%3EB%3C%2Fname%3E%0A++++%3C%2Ftool%3E%0A++++%0A++++%3Ctool%3E%0A++++++++%3Cname%3EC%3C%2Fname%3E%0A++++%3C%2Ftool%3E%0A%3C%2Ftools%3E'
   21     1        NEW                                                  $5      'DOMDocument'
          2        SEND_VAL_EX                                                  '1.0'
          3        SEND_VAL_EX                                                  'utf-8'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   22     6        INIT_METHOD_CALL                                             !1, 'loadXML'
          7        SEND_VAR_EX                                                  !0
          8        DO_FCALL                                          0          
   24     9        NEW                                                  $9      'DOMXPath'
         10        SEND_VAR_EX                                                  !1
         11        DO_FCALL                                          0          
         12        ASSIGN                                                       !2, $9
   26    13        INIT_METHOD_CALL                                             !2, 'query'
         14        SEND_VAL_EX                                                  '%2Ftools%2Ftool%5Bname%5Btext%28%29+%3D+%22B%22%5D%5D'
         15        DO_FCALL                                          0  $12     
         16      > FE_RESET_R                                           $13     $12, ->22
         17    > > FE_FETCH_R                                                   $13, !3, ->22
   27    18    >   INIT_FCALL                                                   'print_r'
         19        SEND_VAR                                                     !3
         20        DO_ICALL                                                     
   26    21      > JMP                                                          ->17
         22    >   FE_FREE                                                      $13
   28    23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.33 ms | 2141 KiB | 14 Q