3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml = '<?xml version="1.0" encoding="UTF-8"?> <root>Тест кириллицы</root> '; $original = new DOMDocument; $original->loadXML($xml); echo $original->saveXML(); echo PHP_EOL . PHP_EOL; // this is code from \SebastianBergmann\Comparator\DOMNodeComparator::nodeToText $document = new DOMDocument; @$document->loadXML($original->C14N()); echo $document->saveXML(); echo PHP_EOL . PHP_EOL; // if I add utf-8 xml header then document is good $document = new DOMDocument; @$document->loadXML('<?xml version="1.0" encoding="' . $original->encoding . '"?>' . PHP_EOL . $original->C14N()); echo $document->saveXML();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/YfMoq
function name:  (null)
number of ops:  44
compiled vars:  !0 = $xml, !1 = $original, !2 = $document
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-8%22%3F%3E%0A%3Croot%3E%D0%A2%D0%B5%D1%81%D1%82+%D0%BA%D0%B8%D1%80%D0%B8%D0%BB%D0%BB%D0%B8%D1%86%D1%8B%3C%2Froot%3E%0A'
    7     1        NEW                                              $4      'DOMDocument'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !1, $4
    8     4        INIT_METHOD_CALL                                         !1, 'loadXML'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
   10     7        INIT_METHOD_CALL                                         !1, 'saveXML'
          8        DO_FCALL                                      0  $8      
          9        ECHO                                                     $8
   12    10        ECHO                                                     '%0A%0A'
   15    11        NEW                                              $9      'DOMDocument'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !2, $9
   16    14        BEGIN_SILENCE                                    ~12     
         15        INIT_METHOD_CALL                                         !2, 'loadXML'
         16        INIT_METHOD_CALL                                         !1, 'C14N'
         17        DO_FCALL                                      0  $13     
         18        SEND_VAR_NO_REF_EX                                       $13
         19        DO_FCALL                                      0          
         20        END_SILENCE                                              ~12
   17    21        INIT_METHOD_CALL                                         !2, 'saveXML'
         22        DO_FCALL                                      0  $15     
         23        ECHO                                                     $15
   19    24        ECHO                                                     '%0A%0A'
   22    25        NEW                                              $16     'DOMDocument'
         26        DO_FCALL                                      0          
         27        ASSIGN                                                   !2, $16
   23    28        BEGIN_SILENCE                                    ~19     
         29        INIT_METHOD_CALL                                         !2, 'loadXML'
         30        FETCH_OBJ_R                                      ~20     !1, 'encoding'
         31        CONCAT                                           ~21     '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22', ~20
         32        CONCAT                                           ~22     ~21, '%22%3F%3E'
         33        CONCAT                                           ~23     ~22, '%0A'
         34        INIT_METHOD_CALL                                         !1, 'C14N'
         35        DO_FCALL                                      0  $24     
         36        CONCAT                                           ~25     ~23, $24
         37        SEND_VAL_EX                                              ~25
         38        DO_FCALL                                      0          
         39        END_SILENCE                                              ~19
   24    40        INIT_METHOD_CALL                                         !2, 'saveXML'
         41        DO_FCALL                                      0  $27     
         42        ECHO                                                     $27
         43      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
123.27 ms | 1439 KiB | 13 Q