3v4l.org

run code in 300+ PHP versions simultaneously
<?php class generateXML { private $dataArray = Array ( "name" => "Sunil", "age" => 21, "city" => "Gzb"); function __construct() { $this->xmlCreate(); } function __destruct() { } function xmlCreate() { $doc = new DOMDocument('1.0'); $doc->formatOutput = true; $root = $doc->createElement('user'); $root = $doc->appendChild($root); foreach ($this->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/aDrEk
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     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/aDrEk
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_METHOD_CALL                                         'xmlCreate'
          1        DO_FCALL                                      0          
   13     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/aDrEk
function name:  __destruct
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     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/aDrEk
function name:  xmlCreate
number of ops:  41
compiled vars:  !0 = $doc, !1 = $root, !2 = $value, !3 = $key, !4 = $title, !5 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $6      'DOMDocument'
          1        SEND_VAL_EX                                              '1.0'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $6
   20     4        ASSIGN_OBJ                                               !0, 'formatOutput'
          5        OP_DATA                                                  <true>
   21     6        INIT_METHOD_CALL                                         !0, 'createElement'
          7        SEND_VAL_EX                                              'user'
          8        DO_FCALL                                      0  $10     
          9        ASSIGN                                                   !1, $10
   22    10        INIT_METHOD_CALL                                         !0, 'appendChild'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $12     
         13        ASSIGN                                                   !1, $12
   24    14        FETCH_OBJ_R                                      ~14     'dataArray'
         15      > FE_RESET_R                                       $15     ~14, ->35
         16    > > FE_FETCH_R                                       ~16     $15, !2, ->35
         17    >   ASSIGN                                                   !3, ~16
   26    18        INIT_METHOD_CALL                                         !0, 'createElement'
         19        SEND_VAR_EX                                              !3
         20        DO_FCALL                                      0  $18     
         21        ASSIGN                                                   !4, $18
   27    22        INIT_METHOD_CALL                                         !1, 'appendChild'
         23        SEND_VAR_EX                                              !4
         24        DO_FCALL                                      0  $20     
         25        ASSIGN                                                   !4, $20
   28    26        INIT_METHOD_CALL                                         !0, 'createTextNode'
         27        SEND_VAR_EX                                              !2
         28        DO_FCALL                                      0  $22     
         29        ASSIGN                                                   !5, $22
   29    30        INIT_METHOD_CALL                                         !4, 'appendChild'
         31        SEND_VAR_EX                                              !5
         32        DO_FCALL                                      0  $24     
         33        ASSIGN                                                   !5, $24
   24    34      > JMP                                                      ->16
         35    >   FE_FREE                                                  $15
   32    36        INIT_METHOD_CALL                                         !0, 'saveXML'
         37        DO_FCALL                                      0  $26     
         38        CONCAT                                           ~27     $26, '%0A'
         39        ECHO                                                     ~27
   36    40      > RETURN                                                   null

End of function xmlcreate

End of class generateXML.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.95 ms | 1390 KiB | 13 Q