3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xml ='<?xml version="1.0" encoding="utf-8"?> <products> <product ID="12345"> <name>Sunny Beach Resort</name> <price currency="EUR">439.00</price> <URL>https://www.example.com/</URL> <images> <image>https://www.example.com/images/image.jpg</image> </images> <properties> <property name="country"> <value>Spanje</value> </property> <property name="region"> <value>Gran Canaria</value> </property> <property name="cityURL"> <value>https://www.example.com/</value> </property> <property name="serviceType"> <value>Logies ontbijt</value> </property> </properties> <variations> <variation> <property name="roomType"> <value>2-persoonskamer luxe type voor alleengebruik</value> </property> <property name="roomOccupation"> <value>geschikt voor 1 persoon</value> </property> </variation> <variation> <property name="roomType"> <value>2-persoonskamer luxe type standaard</value> </property> <property name="roomOccupation"> <value>geschikt voor 2 tot 3 personen</value> </property> </variation> </variations> </product></products>'; $xml = new simplexmlelement($xml); foreach($xml->product as $product) { foreach($product->properties->property as $property) { if($property['name'] == 'serviceType'){ echo 'Service type is' . $property->value . ' for ' . $product ->name; } } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 24
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 24
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 22
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 22
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 21
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 21
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 22
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/bQLUa
function name:  (null)
number of ops:  26
compiled vars:  !0 = $xml, !1 = $product, !2 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fxml+version%3D%221.0%22+encoding%3D%22utf-8%22%3F%3E%0A%3Cproducts%3E%0A++++%3Cproduct+ID%3D%2212345%22%3E%0A++++++++%3Cname%3ESunny+Beach+Resort%3C%2Fname%3E%0A++++++++%3Cprice+currency%3D%22EUR%22%3E439.00%3C%2Fprice%3E%0A++++++++%3CURL%3Ehttps%3A%2F%2Fwww.example.com%2F%3C%2FURL%3E%0A++++++++%3Cimages%3E%0A++++++++++++%3Cimage%3Ehttps%3A%2F%2Fwww.example.com%2Fimages%2Fimage.jpg%3C%2Fimage%3E%0A++++++++%3C%2Fimages%3E%0A++++++++%3Cproperties%3E%0A++++++++++++%3Cproperty+name%3D%22country%22%3E%0A++++++++++++++++%3Cvalue%3ESpanje%3C%2Fvalue%3E%0A++++++++++++%3C%2Fproperty%3E%0A++++++++++++%3Cproperty+name%3D%22region%22%3E%0A++++++++++++++++%3Cvalue%3EGran+Canaria%3C%2Fvalue%3E%0A++++++++++++%3C%2Fproperty%3E%0A++++++++++++%3Cproperty+name%3D%22cityURL%22%3E%0A++++++++++++++++%3Cvalue%3Ehttps%3A%2F%2Fwww.example.com%2F%3C%2Fvalue%3E%0A++++++++++++%3C%2Fproperty%3E%0A++++++++++++%3Cproperty+name%3D%22serviceType%22%3E%0A++++++++++++++++%3Cvalue%3ELogies+ontbijt%3C%2Fvalue%3E%0A++++++++++++%3C%2Fproperty%3E%0A++++++++%3C%2Fproperties%3E%0A++++++++%3Cvariations%3E%0A++++++++++++%3Cvariation%3E%0A++++++++++++++++%3Cproperty+name%3D%22roomType%22%3E%0A++++++++++++++++++++%3Cvalue%3E2-persoonskamer+luxe+type+voor+alleengebruik%3C%2Fvalue%3E%0A++++++++++++++++%3C%2Fproperty%3E%0A++++++++++++++++%3Cproperty+name%3D%22roomOccupation%22%3E%0A++++++++++++++++++++%3Cvalue%3Egeschikt+voor+1+persoon%3C%2Fvalue%3E%0A++++++++++++++++%3C%2Fproperty%3E%0A++++++++++++%3C%2Fvariation%3E%0A++++++++++++%3Cvariation%3E%0A++++++++++++++++%3Cproperty+name%3D%22roomType%22%3E%0A++++++++++++++++++++%3Cvalue%3E2-persoonskamer+luxe+type+standaard%3C%2Fvalue%3E%0A++++++++++++++++%3C%2Fproperty%3E%0A++++++++++++++++%3Cproperty+name%3D%22roomOccupation%22%3E%0A++++++++++++++++++++%3Cvalue%3Egeschikt+voor+2+tot+3+personen%3C%2Fvalue%3E%0A++++++++++++++++%3C%2Fproperty%3E%0A++++++++++++%3C%2Fvariation%3E%0A++++++++%3C%2Fvariations%3E%0A++++%3C%2Fproduct%3E%3C%2Fproducts%3E'
   44     1        NEW                                              $4      'simplexmlelement'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $4
   45     5        FETCH_OBJ_R                                      ~7      !0, 'product'
          6      > FE_RESET_R                                       $8      ~7, ->24
          7    > > FE_FETCH_R                                               $8, !1, ->24
   46     8    >   FETCH_OBJ_R                                      ~9      !1, 'properties'
          9        FETCH_OBJ_R                                      ~10     ~9, 'property'
         10      > FE_RESET_R                                       $11     ~10, ->22
         11    > > FE_FETCH_R                                               $11, !2, ->22
   47    12    >   FETCH_DIM_R                                      ~12     !2, 'name'
         13        IS_EQUAL                                                 ~12, 'serviceType'
         14      > JMPZ                                                     ~13, ->21
   48    15    >   FETCH_OBJ_R                                      ~14     !2, 'value'
         16        CONCAT                                           ~15     'Service+type+is', ~14
         17        CONCAT                                           ~16     ~15, '+for+'
         18        FETCH_OBJ_R                                      ~17     !1, 'name'
         19        CONCAT                                           ~18     ~16, ~17
         20        ECHO                                                     ~18
   46    21    > > JMP                                                      ->11
         22    >   FE_FREE                                                  $11
   45    23      > JMP                                                      ->7
         24    >   FE_FREE                                                  $8
   51    25      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.02 ms | 1007 KiB | 13 Q