3v4l.org

run code in 300+ PHP versions simultaneously
<?php header('Content-type: text/plain; charset=utf-8'); error_reporting(0); ////////////////////////////////////////// $urlParams = explode('/', $_SERVER['REQUEST_URI']); $word = $urlParams[2]; $url = "http://www.oxfordlearnersdictionaries.com/definition/english/comfortable"; ////////////////////////////////////////// $dom = new DOMDocument; $dom->loadHTMLFile($url); $xpath = new DOMXPath($dom); $qx = '//*[@class="pron-gs ei-g"]/span[@class="pron-g"]'; $nodes = $xpath->query($qx); /* Set HTTP response header to plain text for debugging output */ header("Content-type: text/plain"); /* Traverse the DOMNodeList object to output each DomNode's nodeValue */ foreach ($nodes as $i => $node) { echo "\n\n", "Node($i): ", $node->C14N(), "\n"; } //*[@id="ceremony__10"]/span[2] //*[@id="tab3"]/div/div[1]/strong/span //$rqx5 = '//div[@class="tudich"]/div[@class="candich"]'; // tieu de co han tu //$rqx5 = '//div[@class="tudich"]/div[@class="kqdich"]/div[@class="nddich"]/span'; // khong co han tu //$rqx5 = '//div[@class="tudich"]/div[@class="kqdich"]/div[@class="nddich"]/strong[1]'; // nghia //$result = array(); // foreach ($nodes as $i => $node) { // $child = $xpath->query($rqx5, $node)->item(0); // if (!empty($child)) { // echo PHP_EOL . $i ." = ". $child->nodeValue; // } // else { // echo PHP_EOL . $i ." = ". ":)"; // } // } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 35, Position 2 = 47
Branch analysis from position: 35
2 jumps found. (Code = 78) Position 1 = 36, Position 2 = 47
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
Branch analysis from position: 47
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 47
filename:       /in/Wpd1d
function name:  (null)
number of ops:  49
compiled vars:  !0 = $urlParams, !1 = $word, !2 = $url, !3 = $dom, !4 = $xpath, !5 = $qx, !6 = $nodes, !7 = $node, !8 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'header'
          1        SEND_VAL                                                 'Content-type%3A+text%2Fplain%3B+charset%3Dutf-8'
          2        DO_ICALL                                                 
    3     3        INIT_FCALL                                               'error_reporting'
          4        SEND_VAL                                                 0
          5        DO_ICALL                                                 
    5     6        INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '%2F'
          8        FETCH_R                      global              ~11     '_SERVER'
          9        FETCH_DIM_R                                      ~12     ~11, 'REQUEST_URI'
         10        SEND_VAL                                                 ~12
         11        DO_ICALL                                         $13     
         12        ASSIGN                                                   !0, $13
    6    13        FETCH_DIM_R                                      ~15     !0, 2
         14        ASSIGN                                                   !1, ~15
    7    15        ASSIGN                                                   !2, 'http%3A%2F%2Fwww.oxfordlearnersdictionaries.com%2Fdefinition%2Fenglish%2Fcomfortable'
    9    16        NEW                                              $18     'DOMDocument'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !3, $18
   10    19        INIT_METHOD_CALL                                         !3, 'loadHTMLFile'
         20        SEND_VAR_EX                                              !2
         21        DO_FCALL                                      0          
   11    22        NEW                                              $22     'DOMXPath'
         23        SEND_VAR_EX                                              !3
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !4, $22
   13    26        ASSIGN                                                   !5, '%2F%2F%2A%5B%40class%3D%22pron-gs+ei-g%22%5D%2Fspan%5B%40class%3D%22pron-g%22%5D'
   15    27        INIT_METHOD_CALL                                         !4, 'query'
         28        SEND_VAR_EX                                              !5
         29        DO_FCALL                                      0  $26     
         30        ASSIGN                                                   !6, $26
   17    31        INIT_FCALL                                               'header'
         32        SEND_VAL                                                 'Content-type%3A+text%2Fplain'
         33        DO_ICALL                                                 
   21    34      > FE_RESET_R                                       $29     !6, ->47
         35    > > FE_FETCH_R                                       ~30     $29, !7, ->47
         36    >   ASSIGN                                                   !8, ~30
   22    37        ECHO                                                     '%0A%0A'
         38        ROPE_INIT                                     3  ~33     'Node%28'
         39        ROPE_ADD                                      1  ~33     ~33, !8
         40        ROPE_END                                      2  ~32     ~33, '%29%3A+'
         41        ECHO                                                     ~32
         42        INIT_METHOD_CALL                                         !7, 'C14N'
         43        DO_FCALL                                      0  $35     
         44        ECHO                                                     $35
         45        ECHO                                                     '%0A'
   21    46      > JMP                                                      ->35
         47    >   FE_FREE                                                  $29
   45    48      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.09 ms | 1400 KiB | 19 Q