3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = <<<HTML <div class="directions"> <div class="left">ä,ö,ü</div> <div class="right">right</div> </div> HTML; libxml_use_internal_errors(true); libxml_disable_entity_loader(true); $html = new DOMDocument(); $html->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8')); $xpath = new DOMXpath($html); $result = $xpath->query('//div[contains(@class, "left")]'); echo $result[0]->textContent;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/M0TQX
function name:  (null)
number of ops:  30
compiled vars:  !0 = $content, !1 = $html, !2 = $xpath, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Cdiv+class%3D%22directions%22%3E%0A++++%3Cdiv+class%3D%22left%22%3E%C3%A4%2C%C3%B6%2C%C3%BC%3C%2Fdiv%3E%0A++++%3Cdiv+class%3D%22right%22%3Eright%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   10     1        INIT_FCALL                                               'libxml_use_internal_errors'
          2        SEND_VAL                                                 <true>
          3        DO_ICALL                                                 
   11     4        INIT_FCALL                                               'libxml_disable_entity_loader'
          5        SEND_VAL                                                 <true>
          6        DO_FCALL_BY_NAME                                         
   13     7        NEW                                              $7      'DOMDocument'
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   14    10        INIT_METHOD_CALL                                         !1, 'loadHTML'
         11        INIT_FCALL                                               'mb_convert_encoding'
         12        SEND_VAR                                                 !0
         13        SEND_VAL                                                 'HTML-ENTITIES'
         14        SEND_VAL                                                 'UTF-8'
         15        DO_ICALL                                         $10     
         16        SEND_VAR_NO_REF_EX                                       $10
         17        DO_FCALL                                      0          
   15    18        NEW                                              $12     'DOMXpath'
         19        SEND_VAR_EX                                              !1
         20        DO_FCALL                                      0          
         21        ASSIGN                                                   !2, $12
   16    22        INIT_METHOD_CALL                                         !2, 'query'
         23        SEND_VAL_EX                                              '%2F%2Fdiv%5Bcontains%28%40class%2C+%22left%22%29%5D'
         24        DO_FCALL                                      0  $15     
         25        ASSIGN                                                   !3, $15
   17    26        FETCH_DIM_R                                      ~17     !3, 0
         27        FETCH_OBJ_R                                      ~18     ~17, 'textContent'
         28        ECHO                                                     ~18
   18    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
131.11 ms | 955 KiB | 16 Q