3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json = ' { "toppings": [ { "id": "5002", "type": "Glazed" }, { "id": "5006", "type": "Chocolate" }, { "id": "5002", "type": "Glazed" } ] }'; $items = json_decode($json); $searchIds = [5002,5006]; foreach($searchIds as $search) { foreach($items->toppings as $item) { if($item->id == $search) { echo $item->type; } break; } continue; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 21
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 16
Branch analysis from position: 18
Branch analysis from position: 18
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/q8p28
function name:  (null)
number of ops:  23
compiled vars:  !0 = $json, !1 = $items, !2 = $searchIds, !3 = $search, !4 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%0A%7B%0A++++%22toppings%22%3A+%5B%0A++++++++%7B+%22id%22%3A+%225002%22%2C+%22type%22%3A+%22Glazed%22+%7D%2C%0A++++++++%7B+%22id%22%3A+%225006%22%2C+%22type%22%3A+%22Chocolate%22+%7D%2C%0A++++++++%7B+%22id%22%3A+%225002%22%2C+%22type%22%3A+%22Glazed%22+%7D%0A++++%5D%0A%7D'
   12     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $6      
          4        ASSIGN                                                   !1, $6
   14     5        ASSIGN                                                   !2, <array>
   16     6      > FE_RESET_R                                       $9      !2, ->21
          7    > > FE_FETCH_R                                               $9, !3, ->21
   18     8    >   FETCH_OBJ_R                                      ~10     !1, 'toppings'
          9      > FE_RESET_R                                       $11     ~10, ->18
         10    > > FE_FETCH_R                                               $11, !4, ->18
   20    11    >   FETCH_OBJ_R                                      ~12     !4, 'id'
         12        IS_EQUAL                                                 !3, ~12
         13      > JMPZ                                                     ~13, ->16
   22    14    >   FETCH_OBJ_R                                      ~14     !4, 'type'
         15        ECHO                                                     ~14
   24    16    > > JMP                                                      ->18
   18    17*       JMP                                                      ->10
         18    >   FE_FREE                                                  $11
   27    19      > JMP                                                      ->7
   16    20*       JMP                                                      ->7
         21    >   FE_FREE                                                  $9
   29    22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.14 ms | 998 KiB | 14 Q