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": "left", "verbal_cue": "on" }, { "id": 29, "video_id": 5, "wistia_id": "0puffz75s7", "camera_angle": "front", "starting_foot": "right", "verbal_cue": "off" }, { "id": 30, "video_id": 5, "wistia_id": "9drxqjvfjm", "camera_angle": "back", "starting_foot": "left", "verbal_cue": "on" }, { "id": 31, "video_id": 5, "wistia_id": "2ivgoapitc", "camera_angle": "back", "starting_foot": "right", "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)) { foreach ($uploadedAssets as $asset) { $match = true; foreach ($demands as $demand) { if ($asset[$demand['attribute']] != $demand['value']) { $match = false; break; } } if ($match) { $goodAsset = $asset; break; } } array_pop($demands); } var_dump($goodAsset);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 8
Branch analysis from position: 33
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 = 44) Position 1 = 33, Position 2 = 8
Branch analysis from position: 33
Branch analysis from position: 8
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
filename:       /in/bfBDr
function name:  (null)
number of ops:  37
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+%22left%22%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+%22right%22%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+%22left%22%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+%22right%22%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                                                      ->30
   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
   61    27        INIT_FCALL                                               'array_pop'
         28        SEND_REF                                                 !2
         29        DO_ICALL                                                 
   44    30    >   ISSET_ISEMPTY_CV                                 ~20     !2
         31        BOOL_NOT                                         ~21     ~20
         32      > JMPNZ                                                    ~21, ->8
   63    33    >   INIT_FCALL                                               'var_dump'
         34        SEND_VAR                                                 !1
         35        DO_ICALL                                                 
         36      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
246.02 ms | 1400 KiB | 19 Q