3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstring = " <xml> <SHOP> <SHOPITEM> <ITEM_ID>item id</ITEM_ID> <SKU>item SKU </SKU> <PRODUCT>Product name</PRODUCT> <DESCRIPTION>Item descirption</DESCRIPTION> <URL> https://www.itemurl.com/item </URL> <IMGURL> https://www.itemurl.com/itemimg.jpg </IMGURL> <IMG_ALTERNATIVE> https://www.itemurl.com/itemimg2.jpg </IMG_ALTERNATIVE> <IMG_ALTERNATIVE> https://www.itemurl.com/itemimg3.jpg </IMG_ALTERNATIVE> </SHOPITEM> </SHOP> </xml> "; $array = array(); $xml = new SimpleXMLElement($xmlstring); foreach ($xml->SHOP->SHOPITEM as $element) { foreach($element as $key => $val) { array_push ( $array,"{$key}: {$val}"); } } print_r($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 23
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 21
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 21
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/0igDF
function name:  (null)
number of ops:  28
compiled vars:  !0 = $xmlstring, !1 = $array, !2 = $xml, !3 = $element, !4 = $val, !5 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%3Cxml%3E%0A%09%3CSHOP%3E%0A%09%09%3CSHOPITEM%3E%0A%09%09%09%3CITEM_ID%3Eitem+id%3C%2FITEM_ID%3E%0A%09%09%09%3CSKU%3Eitem+SKU+%3C%2FSKU%3E%0A%09%09%09%3CPRODUCT%3EProduct+name%3C%2FPRODUCT%3E%0A%09%09%09%3CDESCRIPTION%3EItem+descirption%3C%2FDESCRIPTION%3E%0A%09%09%09%3CURL%3E%0Ahttps%3A%2F%2Fwww.itemurl.com%2Fitem%0A%3C%2FURL%3E%0A%09%09%09%3CIMGURL%3E%0Ahttps%3A%2F%2Fwww.itemurl.com%2Fitemimg.jpg%0A%3C%2FIMGURL%3E%0A%09%09%09%3CIMG_ALTERNATIVE%3E%0Ahttps%3A%2F%2Fwww.itemurl.com%2Fitemimg2.jpg%0A%3C%2FIMG_ALTERNATIVE%3E%0A%09%09%09%3CIMG_ALTERNATIVE%3E%0Ahttps%3A%2F%2Fwww.itemurl.com%2Fitemimg3.jpg%0A%3C%2FIMG_ALTERNATIVE%3E%0A%09%09%3C%2FSHOPITEM%3E%0A%09%3C%2FSHOP%3E%0A%3C%2Fxml%3E%0A'
   27     1        ASSIGN                                                   !1, <array>
   28     2        NEW                                              $8      'SimpleXMLElement'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !2, $8
   29     6        FETCH_OBJ_R                                      ~11     !2, 'SHOP'
          7        FETCH_OBJ_R                                      ~12     ~11, 'SHOPITEM'
          8      > FE_RESET_R                                       $13     ~12, ->23
          9    > > FE_FETCH_R                                               $13, !3, ->23
   30    10    > > FE_RESET_R                                       $14     !3, ->21
         11    > > FE_FETCH_R                                       ~15     $14, !4, ->21
         12    >   ASSIGN                                                   !5, ~15
   31    13        INIT_FCALL                                               'array_push'
         14        SEND_REF                                                 !1
         15        ROPE_INIT                                     3  ~18     !5
         16        ROPE_ADD                                      1  ~18     ~18, '%3A+'
         17        ROPE_END                                      2  ~17     ~18, !4
         18        SEND_VAL                                                 ~17
         19        DO_ICALL                                                 
   30    20      > JMP                                                      ->11
         21    >   FE_FREE                                                  $14
   29    22      > JMP                                                      ->9
         23    >   FE_FREE                                                  $13
   34    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !1
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.96 ms | 1004 KiB | 15 Q