3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = '<li class="x ReListCent y"><div>1</div></li><li class="x ReListCent y"><div>1</div><div>2</div><div>3</div><div>4</div><div>5<a>hello</a></div></li>'; $doc = new DOMDocument($html); $doc->loadHTML($html); $xpath = new DOMXPath($doc); print_r($xpath->query('((//li[contains(@class,"ReListCent")])[2]/div)[5]/a')->item(0)->nodeValue);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ei3sN
function name:  (null)
number of ops:  23
compiled vars:  !0 = $html, !1 = $doc, !2 = $xpath
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cli+class%3D%22x+ReListCent+y%22%3E%3Cdiv%3E1%3C%2Fdiv%3E%3C%2Fli%3E%3Cli+class%3D%22x+ReListCent+y%22%3E%3Cdiv%3E1%3C%2Fdiv%3E%3Cdiv%3E2%3C%2Fdiv%3E%3Cdiv%3E3%3C%2Fdiv%3E%3Cdiv%3E4%3C%2Fdiv%3E%3Cdiv%3E5%3Ca%3Ehello%3C%2Fa%3E%3C%2Fdiv%3E%3C%2Fli%3E'
    3     1        NEW                                              $4      'DOMDocument'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $4
    4     5        INIT_METHOD_CALL                                         !1, 'loadHTML'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
    5     8        NEW                                              $8      'DOMXPath'
          9        SEND_VAR_EX                                              !1
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !2, $8
    6    12        INIT_FCALL                                               'print_r'
         13        INIT_METHOD_CALL                                         !2, 'query'
         14        SEND_VAL_EX                                              '%28%28%2F%2Fli%5Bcontains%28%40class%2C%22ReListCent%22%29%5D%29%5B2%5D%2Fdiv%29%5B5%5D%2Fa'
         15        DO_FCALL                                      0  $11     
         16        INIT_METHOD_CALL                                         $11, 'item'
         17        SEND_VAL_EX                                              0
         18        DO_FCALL                                      0  $12     
         19        FETCH_OBJ_R                                      ~13     $12, 'nodeValue'
         20        SEND_VAL                                                 ~13
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.18 ms | 1010 KiB | 14 Q