3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(E_ALL); function xml_encode($mixed, $DOMDocument=null) { if (is_null($DOMDocument)) { $DOMDocument =new DOMDocument; $DOMDocument->formatOutput = true; xml_encode($mixed, $DOMDocument); echo $DOMDocument->saveXML(); } else { if (is_array($mixed)) { $node = $DOMDocument->createElement('urlset', 'hello'); $DOMDocument->appendChild($node); } } } $data = array(); for ($x = 0; $x <= 10; $x++) { $data['urlset'][] = array( 'loc' => 'http://www.example.com/user', 'lastmod' => 'YYYY-MM-DD', 'changefreq' => 'monthly', 'priority' => 0.5 ); } header('Content-Type: application/xml'); echo xml_encode($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 44) Position 1 = 12, Position 2 = 6
Branch analysis from position: 12
Branch analysis from position: 6
filename:       /in/cAHqj
function name:  (null)
number of ops:  20
compiled vars:  !0 = $data, !1 = $x
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     30719
          2        DO_ICALL                                                     
   19     3        ASSIGN                                                       !0, <array>
   20     4        ASSIGN                                                       !1, 0
          5      > JMP                                                          ->10
   21     6    >   FETCH_DIM_W                                          $5      !0, 'urlset'
          7        ASSIGN_DIM                                                   $5
   22     8        OP_DATA                                                      <array>
   20     9        PRE_INC                                                      !1
         10    >   IS_SMALLER_OR_EQUAL                                          !1, 10
         11      > JMPNZ                                                        ~8, ->6
   29    12    >   INIT_FCALL                                                   'header'
         13        SEND_VAL                                                     'Content-Type%3A+application%2Fxml'
         14        DO_ICALL                                                     
   30    15        INIT_FCALL                                                   'xml_encode'
         16        SEND_VAR                                                     !0
         17        DO_FCALL                                          0  $10     
         18        ECHO                                                         $10
         19      > RETURN                                                       1

Function xml_encode:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 17
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 27
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/cAHqj
function name:  xml_encode
number of ops:  28
compiled vars:  !0 = $mixed, !1 = $DOMDocument, !2 = $node
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV_INIT                                            !1      null
    6     2        TYPE_CHECK                                        2          !1
          3      > JMPZ                                                         ~3, ->17
    7     4    >   NEW                                                  $4      'DOMDocument'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !1, $4
    8     7        ASSIGN_OBJ                                                   !1, 'formatOutput'
          8        OP_DATA                                                      <true>
    9     9        INIT_FCALL_BY_NAME                                           'xml_encode'
         10        SEND_VAR_EX                                                  !0
         11        SEND_VAR_EX                                                  !1
         12        DO_FCALL                                          0          
   10    13        INIT_METHOD_CALL                                             !1, 'saveXML'
         14        DO_FCALL                                          0  $9      
         15        ECHO                                                         $9
    6    16      > JMP                                                          ->27
   12    17    >   TYPE_CHECK                                      128          !0
         18      > JMPZ                                                         ~10, ->27
   13    19    >   INIT_METHOD_CALL                                             !1, 'createElement'
         20        SEND_VAL_EX                                                  'urlset'
         21        SEND_VAL_EX                                                  'hello'
         22        DO_FCALL                                          0  $11     
         23        ASSIGN                                                       !2, $11
   14    24        INIT_METHOD_CALL                                             !1, 'appendChild'
         25        SEND_VAR_EX                                                  !2
         26        DO_FCALL                                          0          
   17    27    > > RETURN                                                       null

End of function xml_encode

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
265.59 ms | 2874 KiB | 16 Q