3v4l.org

run code in 300+ PHP versions simultaneously
<?php class generateXML { function __construct() { $this->xmlCreate(); } function __destruct() { } function xmlCreate() { $dataArray = Array ( "name" => "Sunil", "age" => 21, "city" => "Gzb", ); $doc = new DOMDocument('1.0'); $doc->formatOutput = true; $root = $doc->createElement('user'); $root = $doc->appendChild($root); foreach ($dataArray as $key => $value) { $title = $doc->createElement($key); $title = $root->appendChild($title); $text = $doc->createTextNode($value); $text = $title->appendChild($text); } echo $doc->saveXML() . "\n"; // echo "Document saved\n"; // echo "Saving only the title part:\n"; } } ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGkjZ
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   41     0  E > > RETURN                                                   1

Class generateXML:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGkjZ
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_METHOD_CALL                                         'xmlCreate'
          1        DO_FCALL                                      0          
   10     2      > RETURN                                                   null

End of function __construct

Function __destruct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGkjZ
function name:  __destruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E > > RETURN                                                   null

End of function __destruct

Function xmlcreate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 16, Position 2 = 35
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 35
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/MGkjZ
function name:  xmlCreate
number of ops:  41
compiled vars:  !0 = $dataArray, !1 = $doc, !2 = $root, !3 = $value, !4 = $key, !5 = $title, !6 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   ASSIGN                                                   !0, <array>
   21     1        NEW                                              $8      'DOMDocument'
          2        SEND_VAL_EX                                              '1.0'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $8
   22     5        ASSIGN_OBJ                                               !1, 'formatOutput'
          6        OP_DATA                                                  <true>
   23     7        INIT_METHOD_CALL                                         !1, 'createElement'
          8        SEND_VAL_EX                                              'user'
          9        DO_FCALL                                      0  $12     
         10        ASSIGN                                                   !2, $12
   24    11        INIT_METHOD_CALL                                         !1, 'appendChild'
         12        SEND_VAR_EX                                              !2
         13        DO_FCALL                                      0  $14     
         14        ASSIGN                                                   !2, $14
   26    15      > FE_RESET_R                                       $16     !0, ->35
         16    > > FE_FETCH_R                                       ~17     $16, !3, ->35
         17    >   ASSIGN                                                   !4, ~17
   28    18        INIT_METHOD_CALL                                         !1, 'createElement'
         19        SEND_VAR_EX                                              !4
         20        DO_FCALL                                      0  $19     
         21        ASSIGN                                                   !5, $19
   29    22        INIT_METHOD_CALL                                         !2, 'appendChild'
         23        SEND_VAR_EX                                              !5
         24        DO_FCALL                                      0  $21     
         25        ASSIGN                                                   !5, $21
   30    26        INIT_METHOD_CALL                                         !1, 'createTextNode'
         27        SEND_VAR_EX                                              !3
         28        DO_FCALL                                      0  $23     
         29        ASSIGN                                                   !6, $23
   31    30        INIT_METHOD_CALL                                         !5, 'appendChild'
         31        SEND_VAR_EX                                              !6
         32        DO_FCALL                                      0  $25     
         33        ASSIGN                                                   !6, $25
   26    34      > JMP                                                      ->16
         35    >   FE_FREE                                                  $16
   34    36        INIT_METHOD_CALL                                         !1, 'saveXML'
         37        DO_FCALL                                      0  $27     
         38        CONCAT                                           ~28     $27, '%0A'
         39        ECHO                                                     ~28
   38    40      > RETURN                                                   null

End of function xmlcreate

End of class generateXML.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.7 ms | 1399 KiB | 13 Q