3v4l.org

run code in 300+ PHP versions simultaneously
<?php $responses = array('tok1' => '<?xml version="1.0" encoding="UTF-8"?> <GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <OrderArray> <Order> <OrderID>111</OrderID> </Order> <Order> <OrderID>113</OrderID> </Order> </OrderArray> </GetOrdersResponse>', 'tok2' => '<?xml version="1.0" encoding="UTF-8"?> <GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <OrderArray> <Order> <OrderID>121</OrderID> </Order> </OrderArray> </GetOrdersResponse>', 'tok3' => '<?xml version="1.0" encoding="UTF-8"?> <GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <OrderArray> <Order> <OrderID>444</OrderID> </Order> </OrderArray> </GetOrdersResponse>', 'tok4' => '<?xml version="1.0" encoding="UTF-8"?> <GetOrdersResponse xmlns="urn:ebay:apis:eBLBaseComponents"> <OrderArray> <Order> <OrderID>564</OrderID> </Order> </OrderArray> </GetOrdersResponse>'); $auth_tokens = array('tok1', 'tok2', 'tok3', 'tok4'); $xml = new DomDocument(); $xml->loadXML('<Orders></Orders>'); $xmlroot = $xml->documentElement; $respdoc = new DomDocument(); foreach($auth_tokens as $auth_token) { // 4 iterations in loop $response = $responses[$auth_token]; // API xml response $respdoc->loadXML($response); // create a domDocument $resproot = $respdoc->documentElement; // get the root element $resproot = $xml->importNode($resproot, true); // import into XML $xmlroot->appendChild($resproot); } header('content-type: text/xml'); echo $xml->saveXML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 31
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 31
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/nIule
function name:  (null)
number of ops:  39
compiled vars:  !0 = $responses, !1 = $auth_tokens, !2 = $xml, !3 = $xmlroot, !4 = $respdoc, !5 = $auth_token, !6 = $response, !7 = $resproot
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   37     1        ASSIGN                                                   !1, <array>
   38     2        NEW                                              $10     'DomDocument'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $10
   39     5        INIT_METHOD_CALL                                         !2, 'loadXML'
          6        SEND_VAL_EX                                              '%3COrders%3E%3C%2FOrders%3E'
          7        DO_FCALL                                      0          
   40     8        FETCH_OBJ_R                                      ~14     !2, 'documentElement'
          9        ASSIGN                                                   !3, ~14
   41    10        NEW                                              $16     'DomDocument'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !4, $16
   42    13      > FE_RESET_R                                       $19     !1, ->31
         14    > > FE_FETCH_R                                               $19, !5, ->31
   43    15    >   FETCH_DIM_R                                      ~20     !0, !5
         16        ASSIGN                                                   !6, ~20
   44    17        INIT_METHOD_CALL                                         !4, 'loadXML'
         18        SEND_VAR_EX                                              !6
         19        DO_FCALL                                      0          
   45    20        FETCH_OBJ_R                                      ~23     !4, 'documentElement'
         21        ASSIGN                                                   !7, ~23
   46    22        INIT_METHOD_CALL                                         !2, 'importNode'
         23        SEND_VAR_EX                                              !7
         24        SEND_VAL_EX                                              <true>
         25        DO_FCALL                                      0  $25     
         26        ASSIGN                                                   !7, $25
   47    27        INIT_METHOD_CALL                                         !3, 'appendChild'
         28        SEND_VAR_EX                                              !7
         29        DO_FCALL                                      0          
   42    30      > JMP                                                      ->14
         31    >   FE_FREE                                                  $19
   49    32        INIT_FCALL                                               'header'
         33        SEND_VAL                                                 'content-type%3A+text%2Fxml'
         34        DO_ICALL                                                 
   50    35        INIT_METHOD_CALL                                         !2, 'saveXML'
         36        DO_FCALL                                      0  $29     
         37        ECHO                                                     $29
         38      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.21 ms | 1015 KiB | 14 Q