3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <div id="test"><span>hi there</span></div> HTML; $text = '<p>hello world &trade;</p>'; $dom = new DOMDocument('1.0', 'UTF-8'); $dom->loadHTML($html); $node = $dom->getElementById('test'); var_dump($node->textContent); $node->textContent = $text; var_dump($node->textContent == $text); var_dump($dom->saveHTML($node));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NlaKi
function name:  (null)
number of ops:  32
compiled vars:  !0 = $html, !1 = $text, !2 = $dom, !3 = $node
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3Cdiv+id%3D%22test%22%3E%3Cspan%3Ehi+there%3C%2Fspan%3E%3C%2Fdiv%3E'
    5     1        ASSIGN                                                   !1, '%3Cp%3Ehello+world+%26trade%3B%3C%2Fp%3E'
    6     2        NEW                                              $6      'DOMDocument'
          3        SEND_VAL_EX                                              '1.0'
          4        SEND_VAL_EX                                              'UTF-8'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $6
    7     7        INIT_METHOD_CALL                                         !2, 'loadHTML'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
    8    10        INIT_METHOD_CALL                                         !2, 'getElementById'
         11        SEND_VAL_EX                                              'test'
         12        DO_FCALL                                      0  $10     
         13        ASSIGN                                                   !3, $10
    9    14        INIT_FCALL                                               'var_dump'
         15        FETCH_OBJ_R                                      ~12     !3, 'textContent'
         16        SEND_VAL                                                 ~12
         17        DO_ICALL                                                 
   10    18        ASSIGN_OBJ                                               !3, 'textContent'
         19        OP_DATA                                                  !1
   11    20        INIT_FCALL                                               'var_dump'
         21        FETCH_OBJ_R                                      ~15     !3, 'textContent'
         22        IS_EQUAL                                         ~16     !1, ~15
         23        SEND_VAL                                                 ~16
         24        DO_ICALL                                                 
   12    25        INIT_FCALL                                               'var_dump'
         26        INIT_METHOD_CALL                                         !2, 'saveHTML'
         27        SEND_VAR_EX                                              !3
         28        DO_FCALL                                      0  $18     
         29        SEND_VAR                                                 $18
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.57 ms | 1396 KiB | 15 Q