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); var_dump($uploadedAssets); die(); $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; } } if (empty($goodAsset)) { array_pop($demands); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/sp70q
function name:  (null)
number of ops:  40
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
   37     5        INIT_FCALL                                               'var_dump'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   38     8      > EXIT                                                     
   39     9*       ASSIGN                                                   !1, null
   40    10*       ASSIGN                                                   !2, <array>
   45    11*       JMP                                                      ->36
   46    12*       FE_RESET_R                                       $11     !0, ->30
         13*       FE_FETCH_R                                               $11, !3, ->30
   47    14*       ASSIGN                                                   !4, <true>
   48    15*       FE_RESET_R                                       $13     !2, ->25
         16*       FE_FETCH_R                                               $13, !5, ->25
   49    17*       FETCH_DIM_R                                      ~14     !5, 'attribute'
         18*       FETCH_DIM_R                                      ~15     !3, ~14
         19*       FETCH_DIM_R                                      ~16     !5, 'value'
         20*       IS_NOT_EQUAL                                             ~15, ~16
         21*       JMPZ                                                     ~17, ->24
   50    22*       ASSIGN                                                   !4, <false>
   51    23*       JMP                                                      ->25
   48    24*       JMP                                                      ->16
         25*       FE_FREE                                                  $13
   55    26*       JMPZ                                                     !4, ->29
   56    27*       ASSIGN                                                   !1, !3
   57    28*       JMP                                                      ->30
   46    29*       JMP                                                      ->13
         30*       FE_FREE                                                  $11
   61    31*       ISSET_ISEMPTY_CV                                         !1
         32*       JMPZ                                                     ~20, ->36
   62    33*       INIT_FCALL                                               'array_pop'
         34*       SEND_REF                                                 !2
         35*       DO_ICALL                                                 
   45    36*       ISSET_ISEMPTY_CV                                 ~22     !2
         37*       BOOL_NOT                                         ~23     ~22
         38*       JMPNZ                                                    ~23, ->12
   64    39*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.3 ms | 1400 KiB | 19 Q