3v4l.org

run code in 300+ PHP versions simultaneously
<?php $xmlstr = file_get_contents('http://designdelicatessen.com/_source/modules/shop_priceindex/export.php?index=test&iso=uk&site=1'); $feed = new SimpleXMLElement($xmlstr); function findPrice($feed, $id){ foreach($feed->Products->Product as $product){ if($product->Number == $id){ return $product->Price; } } return null; } echo findPrice($feed, 'swv8813'); echo "\n"; echo findPrice($feed, 'swv8814');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GJsTg
function name:  (null)
number of ops:  20
compiled vars:  !0 = $xmlstr, !1 = $feed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'file_get_contents'
          1        SEND_VAL                                                 'http%3A%2F%2Fdesigndelicatessen.com%2F_source%2Fmodules%2Fshop_priceindex%2Fexport.php%3Findex%3Dtest%26iso%3Duk%26site%3D1'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    4     4        NEW                                              $4      'SimpleXMLElement'
          5        SEND_VAR_EX                                              !0
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !1, $4
   15     8        INIT_FCALL                                               'findprice'
          9        SEND_VAR                                                 !1
         10        SEND_VAL                                                 'swv8813'
         11        DO_FCALL                                      0  $7      
         12        ECHO                                                     $7
   16    13        ECHO                                                     '%0A'
   17    14        INIT_FCALL                                               'findprice'
         15        SEND_VAR                                                 !1
         16        SEND_VAL                                                 'swv8814'
         17        DO_FCALL                                      0  $8      
         18        ECHO                                                     $8
         19      > RETURN                                                   1

Function findprice:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 13
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 13
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/GJsTg
function name:  findPrice
number of ops:  16
compiled vars:  !0 = $feed, !1 = $id, !2 = $product
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        FETCH_OBJ_R                                      ~3      !0, 'Products'
          3        FETCH_OBJ_R                                      ~4      ~3, 'Product'
          4      > FE_RESET_R                                       $5      ~4, ->13
          5    > > FE_FETCH_R                                               $5, !2, ->13
    8     6    >   FETCH_OBJ_R                                      ~6      !2, 'Number'
          7        IS_EQUAL                                                 !1, ~6
          8      > JMPZ                                                     ~7, ->12
    9     9    >   FETCH_OBJ_R                                      ~8      !2, 'Price'
         10        FE_FREE                                                  $5
         11      > RETURN                                                   ~8
    7    12    > > JMP                                                      ->5
         13    >   FE_FREE                                                  $5
   12    14      > RETURN                                                   null
   13    15*     > RETURN                                                   null

End of function findprice

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.82 ms | 1407 KiB | 17 Q