3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <html> <body> <span>hi<br>there<br>how<br>are<br>you</span> </body> </html> HTML; $dd = new DOMDocument(); $dd->loadHTML($html); $xpath = new DOMXPath($dd); $results = $xpath->query('//span'); echo $results->count() . "\n"; foreach ($results as $result) { var_dump($result->textContent); var_dump($result->nodeValue); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 30
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 30
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
filename:       /in/Z9GR0
function name:  (null)
number of ops:  32
compiled vars:  !0 = $html, !1 = $dd, !2 = $xpath, !3 = $results, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%0A++++%3Cbody%3E%0A++++++++%3Cspan%3Ehi%3Cbr%3Ethere%3Cbr%3Ehow%3Cbr%3Eare%3Cbr%3Eyou%3C%2Fspan%3E%0A++++%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   11     1        NEW                                              $6      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $6
   12     4        INIT_METHOD_CALL                                         !1, 'loadHTML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   13     7        NEW                                              $10     'DOMXPath'
          8        SEND_VAR_EX                                              !1
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !2, $10
   15    11        INIT_METHOD_CALL                                         !2, 'query'
         12        SEND_VAL_EX                                              '%2F%2Fspan'
         13        DO_FCALL                                      0  $13     
         14        ASSIGN                                                   !3, $13
   17    15        INIT_METHOD_CALL                                         !3, 'count'
         16        DO_FCALL                                      0  $15     
         17        CONCAT                                           ~16     $15, '%0A'
         18        ECHO                                                     ~16
   18    19      > FE_RESET_R                                       $17     !3, ->30
         20    > > FE_FETCH_R                                               $17, !4, ->30
   19    21    >   INIT_FCALL                                               'var_dump'
         22        FETCH_OBJ_R                                      ~18     !4, 'textContent'
         23        SEND_VAL                                                 ~18
         24        DO_ICALL                                                 
   20    25        INIT_FCALL                                               'var_dump'
         26        FETCH_OBJ_R                                      ~20     !4, 'nodeValue'
         27        SEND_VAL                                                 ~20
         28        DO_ICALL                                                 
   18    29      > JMP                                                      ->20
         30    >   FE_FREE                                                  $17
   21    31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.85 ms | 1396 KiB | 15 Q