3v4l.org

run code in 300+ PHP versions simultaneously
<?php $content = '{"sales": [ { "ID": 123456, "transaction_id": "123456789", "key": "sdawa57sd547sad4sadx54ad", "subtotal": 20, "tax": "0", "fees": null, "total": "20", "gateway": "paypal", "email": "email@email.com", "date": "2018-08-01 13:13:55", "discounts": null, "products": [ { "id": 1234, "quantity": 1, "name": "Product 1", "price": 20, "price_name": "" } ] } ] }'; $results= json_decode($content, TRUE); foreach($results['sales'] as $item) { foreach ($item['products'] as $product) { if ($product['id'] == '1234') echo $product['name']; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
2 jumps found. (Code = 78) Position 1 = 9, Position 2 = 20
Branch analysis from position: 9
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 17
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 8
Branch analysis from position: 8
Branch analysis from position: 18
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/sbP8L
function name:  (null)
number of ops:  22
compiled vars:  !0 = $content, !1 = $results, !2 = $item, !3 = $product
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%7B%22sales%22%3A+%5B%0A++++++++%7B%0A++++++++++++%22ID%22%3A+123456%2C%0A++++++++++++%22transaction_id%22%3A+%22123456789%22%2C%0A++++++++++++%22key%22%3A+%22sdawa57sd547sad4sadx54ad%22%2C%0A++++++++++++%22subtotal%22%3A+20%2C%0A++++++++++++%22tax%22%3A+%220%22%2C%0A++++++++++++%22fees%22%3A+null%2C%0A++++++++++++%22total%22%3A+%2220%22%2C%0A++++++++++++%22gateway%22%3A+%22paypal%22%2C%0A++++++++++++%22email%22%3A+%22email%40email.com%22%2C%0A++++++++++++%22date%22%3A+%222018-08-01+13%3A13%3A55%22%2C%0A++++++++++++%22discounts%22%3A+null%2C%0A++++++++++++%22products%22%3A+%5B%0A++++++++++++++++%7B%0A++++++++++++++++++++%22id%22%3A+1234%2C%0A++++++++++++++++++++%22quantity%22%3A+1%2C%0A++++++++++++++++++++%22name%22%3A+%22Product+1%22%2C%0A++++++++++++++++++++%22price%22%3A+20%2C%0A++++++++++++++++++++%22price_name%22%3A+%22%22%0A++++++++++++++++%7D%0A++++++++++++%5D%0A++++++++%7D%0A++++++++%5D%0A++++++++%7D'
   27     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
   28     6        FETCH_DIM_R                                      ~7      !1, 'sales'
          7      > FE_RESET_R                                       $8      ~7, ->20
          8    > > FE_FETCH_R                                               $8, !2, ->20
   29     9    >   FETCH_DIM_R                                      ~9      !2, 'products'
         10      > FE_RESET_R                                       $10     ~9, ->18
         11    > > FE_FETCH_R                                               $10, !3, ->18
   30    12    >   FETCH_DIM_R                                      ~11     !3, 'id'
         13        IS_EQUAL                                                 ~11, '1234'
         14      > JMPZ                                                     ~12, ->17
         15    >   FETCH_DIM_R                                      ~13     !3, 'name'
         16        ECHO                                                     ~13
   29    17    > > JMP                                                      ->11
         18    >   FE_FREE                                                  $10
   28    19      > JMP                                                      ->8
         20    >   FE_FREE                                                  $8
   32    21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.4 ms | 1003 KiB | 14 Q