3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <html> <head> <title></title> </head> <body> <div id="test"> </div> </body> </html> HTML; $document = new DOMDocument; $testDiv = $document->getElementById("test"); $span = $document->createElement("span"); $span->textContent = "Test"; $testDiv->appendChild($span); echo $document->saveHTML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XeGfc
function name:  (null)
number of ops:  21
compiled vars:  !0 = $html, !1 = $document, !2 = $testDiv, !3 = $span
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3Chtml%3E%0A%3Chead%3E%0A%09%3Ctitle%3E%3C%2Ftitle%3E%0A%3C%2Fhead%3E%0A%3Cbody%3E%0A%09%3Cdiv+id%3D%22test%22%3E%0A%09%3C%2Fdiv%3E%0A%3C%2Fbody%3E%0A%3C%2Fhtml%3E'
   15     1        NEW                                              $5      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $5
   16     4        INIT_METHOD_CALL                                         !1, 'getElementById'
          5        SEND_VAL_EX                                              'test'
          6        DO_FCALL                                      0  $8      
          7        ASSIGN                                                   !2, $8
   18     8        INIT_METHOD_CALL                                         !1, 'createElement'
          9        SEND_VAL_EX                                              'span'
         10        DO_FCALL                                      0  $10     
         11        ASSIGN                                                   !3, $10
   19    12        ASSIGN_OBJ                                               !3, 'textContent'
         13        OP_DATA                                                  'Test'
   21    14        INIT_METHOD_CALL                                         !2, 'appendChild'
         15        SEND_VAR_EX                                              !3
         16        DO_FCALL                                      0          
   23    17        INIT_METHOD_CALL                                         !1, 'saveHTML'
         18        DO_FCALL                                      0  $14     
         19        ECHO                                                     $14
         20      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.27 ms | 1394 KiB | 13 Q