3v4l.org

run code in 300+ PHP versions simultaneously
<?php $uploadedAssets = json_decode('[ { "id": 28, "video_id": 5, "wistia_id": "4q9l3wynf5", "camera_angle": "front", "starting_foot": null, "verbal_cue": "on" }, { "id": 29, "video_id": 5, "wistia_id": "0puffz75s7", "camera_angle": "front", "starting_foot": null, "verbal_cue": "off" }, { "id": 30, "video_id": 5, "wistia_id": "9drxqjvfjm", "camera_angle": "back", "starting_foot": null, "verbal_cue": "on" }, { "id": 31, "video_id": 5, "wistia_id": "2ivgoapitc", "camera_angle": "back", "starting_foot": null, "verbal_cue": "off" } ]', true); $goodAsset = null; $demands = [ ['attribute' => 'camera_angle', 'value' => 'front'], ['attribute' => 'starting_foot', 'value' => 'right'], ['attribute' => 'verbal_cue', 'value' => 'off'] ]; while (!empty($demands) || empty($goodAsset)) { foreach ($uploadedAssets as $asset) { $match = true; foreach ($demands as $demand) { if ($asset[$demand['attribute']] != $demand['value']) { $match = false; break; } } if ($match) { $goodAsset = $asset; break; } } if (empty($goodAsset)) { array_pop($demands); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 47) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 38, Position 2 = 8
Branch analysis from position: 38
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 26
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 26
Branch analysis from position: 10
2 jumps found. (Code = 77) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
2 jumps found. (Code = 78) Position 1 = 13, Position 2 = 21
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
2 jumps found. (Code = 47) Position 1 = 35, Position 2 = 37
Branch analysis from position: 35
Branch analysis from position: 37
Branch analysis from position: 32
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
Branch analysis from position: 21
Branch analysis from position: 21
Branch analysis from position: 26
Branch analysis from position: 26
Branch analysis from position: 37
filename:       /in/fJZuL
function name:  (null)
number of ops:  39
compiled vars:  !0 = $uploadedAssets, !1 = $goodAsset, !2 = $demands, !3 = $asset, !4 = $match, !5 = $demand
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%0A%09%09%7B%0A%09%09%09%22id%22%3A+28%2C%0A%09%09%09%22video_id%22%3A+5%2C%0A%09%09%09%22wistia_id%22%3A+%224q9l3wynf5%22%2C%0A%09%09%09%22camera_angle%22%3A+%22front%22%2C%0A%09%09%09%22starting_foot%22%3A+null%2C%0A%09%09%09%22verbal_cue%22%3A+%22on%22%0A%09%09%7D%2C%0A%09%09%7B%0A%09%09%09%22id%22%3A+29%2C%0A%09%09%09%22video_id%22%3A+5%2C%0A%09%09%09%22wistia_id%22%3A+%220puffz75s7%22%2C%0A%09%09%09%22camera_angle%22%3A+%22front%22%2C%0A%09%09%09%22starting_foot%22%3A+null%2C%0A%09%09%09%22verbal_cue%22%3A+%22off%22%0A%09%09%7D%2C%0A%09%09%7B%0A%09%09%09%22id%22%3A+30%2C%0A%09%09%09%22video_id%22%3A+5%2C%0A%09%09%09%22wistia_id%22%3A+%229drxqjvfjm%22%2C%0A%09%09%09%22camera_angle%22%3A+%22back%22%2C%0A%09%09%09%22starting_foot%22%3A+null%2C%0A%09%09%09%22verbal_cue%22%3A+%22on%22%0A%09%09%7D%2C%0A%09%09%7B%0A%09%09%09%22id%22%3A+31%2C%0A%09%09%09%22video_id%22%3A+5%2C%0A%09%09%09%22wistia_id%22%3A+%222ivgoapitc%22%2C%0A%09%09%09%22camera_angle%22%3A+%22back%22%2C%0A%09%09%09%22starting_foot%22%3A+null%2C%0A%09%09%09%22verbal_cue%22%3A+%22off%22%0A%09%09%7D%0A%09%5D'
   36     2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $6      
    3     4        ASSIGN                                                   !0, $6
   38     5        ASSIGN                                                   !1, null
   39     6        ASSIGN                                                   !2, <array>
   44     7      > JMP                                                      ->32
   45     8    > > FE_RESET_R                                       $10     !0, ->26
          9    > > FE_FETCH_R                                               $10, !3, ->26
   46    10    >   ASSIGN                                                   !4, <true>
   47    11      > FE_RESET_R                                       $12     !2, ->21
         12    > > FE_FETCH_R                                               $12, !5, ->21
   48    13    >   FETCH_DIM_R                                      ~13     !5, 'attribute'
         14        FETCH_DIM_R                                      ~14     !3, ~13
         15        FETCH_DIM_R                                      ~15     !5, 'value'
         16        IS_NOT_EQUAL                                             ~14, ~15
         17      > JMPZ                                                     ~16, ->20
   49    18    >   ASSIGN                                                   !4, <false>
   50    19      > JMP                                                      ->21
   47    20    > > JMP                                                      ->12
         21    >   FE_FREE                                                  $12
   54    22      > JMPZ                                                     !4, ->25
   55    23    >   ASSIGN                                                   !1, !3
   56    24      > JMP                                                      ->26
   45    25    > > JMP                                                      ->9
         26    >   FE_FREE                                                  $10
   60    27        ISSET_ISEMPTY_CV                                         !1
         28      > JMPZ                                                     ~19, ->32
   61    29    >   INIT_FCALL                                               'array_pop'
         30        SEND_REF                                                 !2
         31        DO_ICALL                                                 
   44    32    >   ISSET_ISEMPTY_CV                                 ~21     !2
         33        BOOL_NOT                                         ~22     ~21
         34      > JMPNZ_EX                                         ~22     ~22, ->37
         35    >   ISSET_ISEMPTY_CV                                 ~23     !1
         36        BOOL                                             ~22     ~23
         37    > > JMPNZ                                                    ~22, ->8
   63    38    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.18 ms | 1400 KiB | 17 Q