3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Created by PhpStorm. * User: efik * Date: 21.09.15 * Time: 13:28 */ $podcasts = []; foreach (range(1, 150) as $index) { $podcasts[] = [ "id" => $index * mt_rand(1, 4), "title" => "Song - " . $index, "time" => $index, "License" => "MIT", ]; } arsort($podcasts); $dom = new DOMDocument("1.0", "UTF-8"); $podcastDOM = $dom->createElement("podcast"); foreach ($podcasts as $podcast) { $item = $dom->createElement('song'); foreach ($podcast as $key => $value) { if ($key !== "title") { $currentKey = $dom->createAttribute($key); $currentKey->appendChild($dom->createTextNode($value)); } else { $item->appendChild($dom->createTextNode($value)); } $item->appendChild($currentKey); $podcastDOM->appendChild($item); } } $dom->appendChild($podcastDOM); header("Content-Type: text/xml"); echo $dom->saveXML();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 20
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 20
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 34, Position 2 = 70
Branch analysis from position: 34
2 jumps found. (Code = 78) Position 1 = 35, Position 2 = 70
Branch analysis from position: 35
2 jumps found. (Code = 77) Position 1 = 40, Position 2 = 68
Branch analysis from position: 40
2 jumps found. (Code = 78) Position 1 = 41, Position 2 = 68
Branch analysis from position: 41
2 jumps found. (Code = 43) Position 1 = 44, Position 2 = 55
Branch analysis from position: 44
1 jumps found. (Code = 42) Position 1 = 61
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 55
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
Branch analysis from position: 68
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
Branch analysis from position: 68
Branch analysis from position: 70
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 70
Branch analysis from position: 20
filename:       /in/VMhpW
function name:  (null)
number of ops:  81
compiled vars:  !0 = $podcasts, !1 = $index, !2 = $dom, !3 = $podcastDOM, !4 = $podcast, !5 = $item, !6 = $value, !7 = $key, !8 = $currentKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, <array>
    9     1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 150
          4        DO_ICALL                                         $10     
          5      > FE_RESET_R                                       $11     $10, ->20
          6    > > FE_FETCH_R                                               $11, !1, ->20
   12     7    >   INIT_FCALL                                               'mt_rand'
          8        SEND_VAL                                                 1
          9        SEND_VAL                                                 4
         10        DO_ICALL                                         $13     
         11        MUL                                              ~14     !1, $13
         12        INIT_ARRAY                                       ~15     ~14, 'id'
   13    13        CONCAT                                           ~16     'Song+-+', !1
         14        ADD_ARRAY_ELEMENT                                ~15     ~16, 'title'
   14    15        ADD_ARRAY_ELEMENT                                ~15     !1, 'time'
   15    16        ADD_ARRAY_ELEMENT                                ~15     'MIT', 'License'
   10    17        ASSIGN_DIM                                               !0
   15    18        OP_DATA                                                  ~15
    9    19      > JMP                                                      ->6
         20    >   FE_FREE                                                  $11
   18    21        INIT_FCALL                                               'arsort'
         22        SEND_REF                                                 !0
         23        DO_ICALL                                                 
   20    24        NEW                                              $18     'DOMDocument'
         25        SEND_VAL_EX                                              '1.0'
         26        SEND_VAL_EX                                              'UTF-8'
         27        DO_FCALL                                      0          
         28        ASSIGN                                                   !2, $18
   21    29        INIT_METHOD_CALL                                         !2, 'createElement'
         30        SEND_VAL_EX                                              'podcast'
         31        DO_FCALL                                      0  $21     
         32        ASSIGN                                                   !3, $21
   24    33      > FE_RESET_R                                       $23     !0, ->70
         34    > > FE_FETCH_R                                               $23, !4, ->70
   25    35    >   INIT_METHOD_CALL                                         !2, 'createElement'
         36        SEND_VAL_EX                                              'song'
         37        DO_FCALL                                      0  $24     
         38        ASSIGN                                                   !5, $24
   26    39      > FE_RESET_R                                       $26     !4, ->68
         40    > > FE_FETCH_R                                       ~27     $26, !6, ->68
         41    >   ASSIGN                                                   !7, ~27
   27    42        IS_NOT_IDENTICAL                                         !7, 'title'
         43      > JMPZ                                                     ~29, ->55
   28    44    >   INIT_METHOD_CALL                                         !2, 'createAttribute'
         45        SEND_VAR_EX                                              !7
         46        DO_FCALL                                      0  $30     
         47        ASSIGN                                                   !8, $30
   29    48        INIT_METHOD_CALL                                         !8, 'appendChild'
         49        INIT_METHOD_CALL                                         !2, 'createTextNode'
         50        SEND_VAR_EX                                              !6
         51        DO_FCALL                                      0  $32     
         52        SEND_VAR_NO_REF_EX                                       $32
         53        DO_FCALL                                      0          
         54      > JMP                                                      ->61
   31    55    >   INIT_METHOD_CALL                                         !5, 'appendChild'
         56        INIT_METHOD_CALL                                         !2, 'createTextNode'
         57        SEND_VAR_EX                                              !6
         58        DO_FCALL                                      0  $34     
         59        SEND_VAR_NO_REF_EX                                       $34
         60        DO_FCALL                                      0          
   33    61    >   INIT_METHOD_CALL                                         !5, 'appendChild'
         62        SEND_VAR_EX                                              !8
         63        DO_FCALL                                      0          
   35    64        INIT_METHOD_CALL                                         !3, 'appendChild'
         65        SEND_VAR_EX                                              !5
         66        DO_FCALL                                      0          
   26    67      > JMP                                                      ->40
         68    >   FE_FREE                                                  $26
   24    69      > JMP                                                      ->34
         70    >   FE_FREE                                                  $23
   41    71        INIT_METHOD_CALL                                         !2, 'appendChild'
         72        SEND_VAR_EX                                              !3
         73        DO_FCALL                                      0          
   42    74        INIT_FCALL                                               'header'
         75        SEND_VAL                                                 'Content-Type%3A+text%2Fxml'
         76        DO_ICALL                                                 
   43    77        INIT_METHOD_CALL                                         !2, 'saveXML'
         78        DO_FCALL                                      0  $40     
         79        ECHO                                                     $40
         80      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.36 ms | 1409 KiB | 21 Q